From f32603bcf8db7cdd5252af0cc7059c4e77c292ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 17 Nov 2016 19:56:23 +0200 Subject: [PATCH] dvdec: Fix handling of negotiation failures Return NOT_NEGOTIATED if sending the caps event fails, or FLUSHING if the pad was flushing at that point. https://bugzilla.gnome.org/show_bug.cgi?id=774623 --- ext/dv/gstdvdec.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index c279e3e15..c7c193d75 100644 --- a/ext/dv/gstdvdec.c +++ b/ext/dv/gstdvdec.c @@ -303,6 +303,7 @@ static gboolean gst_dvdec_src_negotiate (GstDVDec * dvdec) { GstCaps *othercaps; + gboolean ret; /* no PAR was specified in input, derive from encoded data */ if (dvdec->need_par) { @@ -343,14 +344,14 @@ gst_dvdec_src_negotiate (GstDVDec * dvdec) } othercaps = gst_video_info_to_caps (&dvdec->vinfo); - gst_pad_set_caps (dvdec->srcpad, othercaps); + ret = gst_pad_set_caps (dvdec->srcpad, othercaps); gst_dvdec_negotiate_pool (dvdec, othercaps, &dvdec->vinfo); gst_caps_unref (othercaps); dvdec->src_negotiated = TRUE; - return TRUE; + return ret; } static gboolean @@ -478,7 +479,7 @@ gst_dvdec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) caps = gst_pad_get_current_caps (dvdec->srcpad); if (!caps) - goto not_negotiated; + goto flushing; gst_dvdec_negotiate_pool (dvdec, caps, &dvdec->vinfo); gst_caps_unref (caps); @@ -556,7 +557,16 @@ parse_header_error: not_negotiated: { GST_DEBUG_OBJECT (dvdec, "could not negotiate output"); - ret = GST_FLOW_NOT_NEGOTIATED; + if (GST_PAD_IS_FLUSHING (dvdec->srcpad)) + ret = GST_FLOW_FLUSHING; + else + ret = GST_FLOW_NOT_NEGOTIATED; + goto done; + } +flushing: + { + GST_DEBUG_OBJECT (dvdec, "have no current caps"); + ret = GST_FLOW_FLUSHING; goto done; } no_buffer: -- 2.34.1