gst-plugins-ugly: mad: ensure we do not confuse the base class with our buffer guard

Vincent Penquerc'h vincent at kemper.freedesktop.org
Tue Jan 31 07:54:50 PST 2012


Module: gst-plugins-ugly
Branch: master
Commit: 73330c2ab86f1c8406464ff13db6f61a4bebe2cd
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=73330c2ab86f1c8406464ff13db6f61a4bebe2cd

Author: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
Date:   Tue Jan 31 15:52:38 2012 +0000

mad: ensure we do not confuse the base class with our buffer guard

mad expects extra bytes at the end of a buffer (see discussion in
http://www.mars.org/mailman/public/mad-dev/2001-May/000262.html),
and since we inject these without the base class' knowledge, we
need to hide the bodies better.

This fixes an assert at EOS when decoding an mp3 manually without
an intervening mpegaudioparse.

---

 ext/mad/gstmad.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/ext/mad/gstmad.c b/ext/mad/gstmad.c
index bff7634..8336638 100644
--- a/ext/mad/gstmad.c
+++ b/ext/mad/gstmad.c
@@ -415,6 +415,17 @@ exit:
   *_offset = offset;
   *len = consumed;
 
+  /* ensure that if we added some dummy guard bytes above, we don't claim
+     to have used them as they're unknown to the caller. */
+  if (mad->eos) {
+    g_assert (av >= MAD_BUFFER_GUARD);
+    av -= MAD_BUFFER_GUARD;
+    if (*_offset > av)
+      *_offset = av;
+    if (*len > av)
+      *len = av;
+  }
+
   return ret;
 }
 



More information about the gstreamer-commits mailing list