ext/mpeg2dec/gstmpeg2dec.c: Fix refcounting when cropping. Fixes #341677.

Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (crop_buffer), (handle_slice):
Fix refcounting when cropping. Fixes #341677.
This commit is contained in:
Wim Taymans 2006-07-10 11:52:58 +00:00
parent 4c6764332a
commit 73e2b0c311
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,8 @@
2006-07-10 Wim Taymans <wim@fluendo.com>
* ext/mpeg2dec/gstmpeg2dec.c: (crop_buffer), (handle_slice):
Fix refcounting when cropping. Fixes #341677.
2006-07-09 Wim Taymans <wim@fluendo.com> 2006-07-09 Wim Taymans <wim@fluendo.com>
Patch by: Grzegorz Lukasik <hauserx at gmail dot com> Patch by: Grzegorz Lukasik <hauserx at gmail dot com>

View file

@ -428,6 +428,7 @@ crop_buffer (GstMpeg2dec * mpeg2dec, GstBuffer ** buf)
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (mpeg2dec->srcpad)); gst_buffer_set_caps (outbuf, GST_PAD_CAPS (mpeg2dec->srcpad));
gst_buffer_stamp (outbuf, input); gst_buffer_stamp (outbuf, input);
gst_buffer_unref (input);
*buf = outbuf; *buf = outbuf;
result = TRUE; result = TRUE;
@ -851,14 +852,13 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf))); GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)));
if ((mpeg2dec->decoded_height > mpeg2dec->height) ||
(mpeg2dec->decoded_width > mpeg2dec->width)) {
crop_buffer (mpeg2dec, &outbuf);
}
/* ref before pushing it out, so we still have the ref in our /* ref before pushing it out, so we still have the ref in our
* array of buffers */ * array of buffers */
gst_buffer_ref (outbuf); gst_buffer_ref (outbuf);
/* do cropping if needed */
crop_buffer (mpeg2dec, &outbuf);
ret = gst_pad_push (mpeg2dec->srcpad, outbuf); ret = gst_pad_push (mpeg2dec->srcpad, outbuf);
GST_DEBUG_OBJECT (mpeg2dec, "pushed with result %s", gst_flow_get_name (ret)); GST_DEBUG_OBJECT (mpeg2dec, "pushed with result %s", gst_flow_get_name (ret));