[0.11] gst-plugins-base: audiodecoder: handle empty input by discarding

Tim Müller tpm at kemper.freedesktop.org
Sun Oct 9 08:16:38 PDT 2011


Module: gst-plugins-base
Branch: 0.11
Commit: d8312994aa68a2bade307cf71ed10ae5a2e61748
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=d8312994aa68a2bade307cf71ed10ae5a2e61748

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Sat Oct  8 20:09:09 2011 +0200

audiodecoder: handle empty input by discarding

---

 gst-libs/gst/audio/gstaudiodecoder.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c
index 3843f22..32cbc61 100644
--- a/gst-libs/gst/audio/gstaudiodecoder.c
+++ b/gst-libs/gst/audio/gstaudiodecoder.c
@@ -1065,7 +1065,14 @@ gst_audio_decoder_flush (GstAudioDecoder * dec, gboolean hard)
 static GstFlowReturn
 gst_audio_decoder_chain_forward (GstAudioDecoder * dec, GstBuffer * buffer)
 {
-  GstFlowReturn ret;
+  GstFlowReturn ret = GST_FLOW_OK;
+
+  /* discard silly case, though maybe ts may be of value ?? */
+  if (G_UNLIKELY (GST_BUFFER_SIZE (buffer) == 0)) {
+    GST_DEBUG_OBJECT (dec, "discarding empty buffer");
+    gst_buffer_unref (buffer);
+    goto exit;
+  }
 
   /* grab buffer */
   gst_adapter_push (dec->priv->adapter, buffer);
@@ -1076,6 +1083,7 @@ gst_audio_decoder_chain_forward (GstAudioDecoder * dec, GstBuffer * buffer)
   /* hand to subclass */
   ret = gst_audio_decoder_push_buffers (dec, FALSE);
 
+exit:
   GST_LOG_OBJECT (dec, "chain-done");
   return ret;
 }



More information about the gstreamer-commits mailing list