From 85eac2c31ce7f7ed2aa0dbd4a9dc2ad42b734788 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 30 Jun 2013 18:17:15 +0200 Subject: [PATCH] video(enc|dec)oder: Don't return not-negotiated if flushing If the pad is flushing after a failed negotiation, return GST_FLOW_FLUSHING instead from finish_frame(). https://bugzilla.gnome.org/show_bug.cgi?id=701763 --- gst-libs/gst/video/gstvideodecoder.c | 11 +++++++++-- gst-libs/gst/video/gstvideoencoder.c | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 1f392e3..8ca74d5 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -2429,8 +2429,15 @@ gst_video_decoder_finish_frame (GstVideoDecoder * decoder, GST_VIDEO_DECODER_STREAM_LOCK (decoder); if (G_UNLIKELY (priv->output_state_changed || (priv->output_state - && gst_pad_check_reconfigure (decoder->srcpad)))) - gst_video_decoder_negotiate (decoder); + && gst_pad_check_reconfigure (decoder->srcpad)))) { + if (!gst_video_decoder_negotiate (decoder)) { + if (GST_PAD_IS_FLUSHING (decoder->srcpad)) + ret = GST_FLOW_FLUSHING; + else + ret = GST_FLOW_NOT_NEGOTIATED; + goto done; + } + } gst_video_decoder_prepare_finish_frame (decoder, frame, FALSE); priv->processed++; diff --git a/gst-libs/gst/video/gstvideoencoder.c b/gst-libs/gst/video/gstvideoencoder.c index dff8b19..dd5b8c3 100644 --- a/gst-libs/gst/video/gstvideoencoder.c +++ b/gst-libs/gst/video/gstvideoencoder.c @@ -1729,8 +1729,15 @@ gst_video_encoder_finish_frame (GstVideoEncoder * encoder, GST_VIDEO_ENCODER_STREAM_LOCK (encoder); if (G_UNLIKELY (priv->output_state_changed || (priv->output_state - && gst_pad_check_reconfigure (encoder->srcpad)))) - gst_video_encoder_negotiate (encoder); + && gst_pad_check_reconfigure (encoder->srcpad)))) { + if (!gst_video_encoder_negotiate (encoder)) { + if (GST_PAD_IS_FLUSHING (encoder->srcpad)) + ret = GST_FLOW_FLUSHING; + else + ret = GST_FLOW_NOT_NEGOTIATED; + goto done; + } + } if (G_UNLIKELY (priv->output_state == NULL)) goto no_output_state; -- 2.7.4