From f4fb623aba4a28f1819bf22f9fe3b4af497ce926 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 8 Mar 2016 19:22:18 +0000 Subject: [PATCH] audiodecoder: avoid unnecessary gst_pad_has_current_caps() checks No need to do this for each input buffer, we have the input caps stored somewhere already. https://bugzilla.gnome.org/show_bug.cgi?id=763337 --- gst-libs/gst/audio/gstaudiodecoder.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index 0083759..e65b76c 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -1883,9 +1883,6 @@ gst_audio_decoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) dec = GST_AUDIO_DECODER (parent); - if (G_UNLIKELY (!gst_pad_has_current_caps (pad) && dec->priv->needs_format)) - goto not_negotiated; - GST_LOG_OBJECT (dec, "received buffer of size %" G_GSIZE_FORMAT " with ts %" GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT, gst_buffer_get_size (buffer), @@ -1894,6 +1891,9 @@ gst_audio_decoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) GST_AUDIO_DECODER_STREAM_LOCK (dec); + if (G_UNLIKELY (dec->priv->ctx.input_caps == NULL && dec->priv->needs_format)) + goto not_negotiated; + dec->priv->ctx.had_input_data = TRUE; if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) { @@ -1930,6 +1930,7 @@ gst_audio_decoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) /* ERRORS */ not_negotiated: { + GST_AUDIO_DECODER_STREAM_UNLOCK (dec); GST_ELEMENT_ERROR (dec, CORE, NEGOTIATION, (NULL), ("decoder not initialized")); gst_buffer_unref (buffer); -- 2.7.4