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
This commit is contained in:
Tim-Philipp Müller 2016-03-08 19:22:18 +00:00 committed by Sebastian Dröge
parent 65f721b326
commit f4fb623aba

View file

@ -1883,9 +1883,6 @@ gst_audio_decoder_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
dec = GST_AUDIO_DECODER (parent); 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, GST_LOG_OBJECT (dec,
"received buffer of size %" G_GSIZE_FORMAT " with ts %" GST_TIME_FORMAT "received buffer of size %" G_GSIZE_FORMAT " with ts %" GST_TIME_FORMAT
", duration %" GST_TIME_FORMAT, gst_buffer_get_size (buffer), ", 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); 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; dec->priv->ctx.had_input_data = TRUE;
if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) { 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 */ /* ERRORS */
not_negotiated: not_negotiated:
{ {
GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
GST_ELEMENT_ERROR (dec, CORE, NEGOTIATION, (NULL), GST_ELEMENT_ERROR (dec, CORE, NEGOTIATION, (NULL),
("decoder not initialized")); ("decoder not initialized"));
gst_buffer_unref (buffer); gst_buffer_unref (buffer);