From 0c43005f5496cfc11c46db8c6ddc714d4c7e321a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 8 May 2015 15:06:34 +0200 Subject: [PATCH] audiodecoder: Also negotiate with downstream if needed before handling a GAP event --- gst-libs/gst/audio/gstaudiodecoder.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index db70837eb3..485708e49f 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -1966,12 +1966,6 @@ gst_audio_decoder_negotiate_default_caps (GstAudioDecoder * dec) "Chose default caps %" GST_PTR_FORMAT " for initial gap", caps); gst_caps_unref (caps); - if (!gst_audio_decoder_negotiate_unlocked (dec)) { - GST_INFO_OBJECT (dec, "Failed to negotiate default caps for initial gap"); - gst_pad_mark_reconfigure (dec->srcpad); - return FALSE; - } - return TRUE; caps_error: @@ -1987,6 +1981,7 @@ gst_audio_decoder_handle_gap (GstAudioDecoder * dec, GstEvent * event) { gboolean ret; GstClockTime timestamp, duration; + gboolean needs_reconfigure = FALSE; /* Ensure we have caps first */ GST_AUDIO_DECODER_STREAM_LOCK (dec); @@ -1997,6 +1992,15 @@ gst_audio_decoder_handle_gap (GstAudioDecoder * dec, GstEvent * event) ("Decoder output not negotiated before GAP event.")); return FALSE; } + needs_reconfigure = TRUE; + } + needs_reconfigure = gst_pad_check_reconfigure (dec->srcpad) + || needs_reconfigure; + if (G_UNLIKELY (dec->priv->ctx.output_format_changed || needs_reconfigure)) { + if (!gst_audio_decoder_negotiate_unlocked (dec)) { + GST_WARNING_OBJECT (dec, "Failed to negotiate with downstream"); + gst_pad_mark_reconfigure (dec->srcpad); + } } GST_AUDIO_DECODER_STREAM_UNLOCK (dec);