From 3a81f04d6042b02d92f6561da620572029ba240b Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 16 Aug 2005 09:50:03 +0000 Subject: [PATCH] ext/ffmpeg/gstffmpegdec.c: Handle return values of gst_pad_push(). Original commit message from CVS: * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame), (gst_ffmpegdec_sink_event), (gst_ffmpegdec_chain): Handle return values of gst_pad_push(). --- ChangeLog | 6 ++++++ common | 2 +- ext/ffmpeg/gstffmpegdec.c | 18 ++++++++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7ac657a3c..ce98a21916 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-08-16 Ronald S. Bultje + + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame), + (gst_ffmpegdec_sink_event), (gst_ffmpegdec_chain): + Handle return values of gst_pad_push(). + 2005-08-15 Ronald S. Bultje * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps): diff --git a/common b/common index 856fbbfa88..8ff526a316 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 856fbbfa88621ab67df141ead8d4d3df32c5c176 +Subproject commit 8ff526a316f9b576e727b8e32cba0a53cdec07a6 diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index af717b3ed4..0d390ed75c 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -684,13 +684,13 @@ gst_ffmpegdec_negotiate (GstFFMpegDec * ffmpegdec) static gint gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, - guint8 * data, guint size, gint * got_data, guint64 * in_ts) + guint8 * data, guint size, gint * got_data, guint64 * in_ts, + GstFlowReturn * ret) { GstFFMpegDecClass *oclass = (GstFFMpegDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec)); GstBuffer *outbuf = NULL; gint have_data = 0, len = 0; - GstFlowReturn ret; ffmpegdec->context->frame_number++; @@ -762,8 +762,8 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, if (!gst_ffmpegdec_negotiate (ffmpegdec)) return -1; - if ((ret = gst_pad_alloc_buffer (ffmpegdec->srcpad, GST_BUFFER_OFFSET_NONE, fsize, GST_PAD_CAPS (ffmpegdec->srcpad), &outbuf)) != GST_FLOW_OK) - return ret; + if ((*ret = gst_pad_alloc_buffer (ffmpegdec->srcpad, GST_BUFFER_OFFSET_NONE, fsize, GST_PAD_CAPS (ffmpegdec->srcpad), &outbuf)) != GST_FLOW_OK) + return -1; /* original ffmpeg code does not handle odd sizes correctly. * This patched up version does */ @@ -888,7 +888,7 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, GST_TIME_FORMAT ")", GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf))); gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ffmpegdec->srcpad)); - gst_pad_push (ffmpegdec->srcpad, outbuf); + *ret = gst_pad_push (ffmpegdec->srcpad, outbuf); } return len; @@ -909,8 +909,9 @@ gst_ffmpegdec_sink_event (GstPad * pad, GstEvent * event) if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) { gint have_data, len, try = 0; do { + GstFlowReturn ret; len = gst_ffmpegdec_frame (ffmpegdec, NULL, 0, &have_data, - &ffmpegdec->next_ts); + &ffmpegdec->next_ts, &ret); if (len < 0 || have_data == 0) break; } while (try++ < 10); @@ -975,6 +976,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) guint8 *bdata, *data; gint bsize, size, len, have_data; guint64 in_ts = GST_BUFFER_TIMESTAMP (inbuf); + GstFlowReturn ret = GST_FLOW_OK; if (!ffmpegdec->opened) goto not_negotiated; @@ -1033,7 +1035,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) } if ((len = gst_ffmpegdec_frame (ffmpegdec, data, size, - &have_data, &in_ts)) < 0) + &have_data, &in_ts, &ret)) < 0 || ret != GST_FLOW_OK) break; if (!ffmpegdec->pctx) { @@ -1057,7 +1059,7 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf) } gst_buffer_unref (inbuf); - return GST_FLOW_OK; + return ret; /* ERRORS */ not_negotiated: