summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJulien Moutte <julien@moutte.net>2005-11-28 22:13:33 +0000
committerJulien Moutte <julien@moutte.net>2005-11-28 22:13:33 +0000
commitff7304769f2f5f6548cbbda3894b6d3c41e063fd (patch)
treeff6f4ec2994d1fc09ac1ba0be3ca2e68d2d62836 /sys
parent4ab53214007002d566ad13cfe50643738744bcb8 (diff)
sys/: Fixed a tricky bug. When caps renegotiation happens (only visible on ximagesink but bug is in xv too) set_caps ...
Original commit message from CVS: 2005-11-28 Julien MOUTTE <julien@moutte.net> * sys/ximage/ximagesink.c: (gst_ximagesink_ximage_put), (gst_ximagesink_setcaps): * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xvimage_put), (gst_xvimagesink_setcaps): Fixed a tricky bug. When caps renegotiation happens (only visible on ximagesink but bug is in xv too) set_caps was destroying the internal x[v]image used to memcpy non locally alloced buffers so that it got renewed on next _chain. The issue is that _expose will try to put that image as it reffed it in _put. Using gst_buffer_unref instead of destroy fixes it !
Diffstat (limited to 'sys')
-rw-r--r--sys/ximage/ximagesink.c5
-rw-r--r--sys/xvimage/xvimagesink.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c
index 91a7200b..0981f8dd 100644
--- a/sys/ximage/ximagesink.c
+++ b/sys/ximage/ximagesink.c
@@ -574,6 +574,7 @@ gst_ximagesink_ximage_put (GstXImageSink * ximagesink, GstXImageBuffer * ximage)
GST_DEBUG_OBJECT (ximagesink, "unreffing %p", ximagesink->cur_image);
gst_buffer_unref (ximagesink->cur_image);
}
+ GST_DEBUG_OBJECT (ximagesink, "reffing %p as our current image", ximage);
ximagesink->cur_image = GST_XIMAGE_BUFFER (gst_buffer_ref (ximage));
}
@@ -1249,7 +1250,9 @@ gst_ximagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
if ((ximagesink->ximage) &&
((GST_VIDEO_SINK_WIDTH (ximagesink) != ximagesink->ximage->width) ||
(GST_VIDEO_SINK_HEIGHT (ximagesink) != ximagesink->ximage->height))) {
- gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
+ GST_DEBUG_OBJECT (ximagesink, "our image is not usable anymore, unref %p",
+ ximagesink->ximage);
+ gst_buffer_unref (GST_BUFFER (ximagesink->ximage));
ximagesink->ximage = NULL;
}
diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c
index 0d00da42..92ab68c2 100644
--- a/sys/xvimage/xvimagesink.c
+++ b/sys/xvimage/xvimagesink.c
@@ -598,6 +598,7 @@ gst_xvimagesink_xvimage_put (GstXvImageSink * xvimagesink,
GST_DEBUG_OBJECT (xvimagesink, "unreffing %p", xvimagesink->cur_image);
gst_buffer_unref (xvimagesink->cur_image);
}
+ GST_DEBUG_OBJECT (xvimagesink, "reffing %p as our current image", xvimage);
xvimagesink->cur_image = GST_XVIMAGE_BUFFER (gst_buffer_ref (xvimage));
}
@@ -1641,7 +1642,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
GST_FOURCC_ARGS (xvimagesink->xcontext->im_format),
GST_FOURCC_ARGS (im_format));
GST_DEBUG_OBJECT (xvimagesink, "renewing xvimage");
- gst_xvimage_buffer_free (xvimagesink->xvimage);
+ gst_buffer_unref (GST_BUFFER (xvimagesink->xvimage));
xvimagesink->xvimage = NULL;
}