[gst-cvs] gst-plugins-ugly: mpegaudioparse: Fix stop condition for outputting buffers .

Edward Hervey bilboed at kemper.freedesktop.org
Wed May 6 03:57:15 PDT 2009


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

Author: Edward Hervey <bilboed at bilboed.com>
Date:   Wed May  6 13:13:35 2009 +0200

mpegaudioparse: Fix stop condition for outputting buffers.

Some mp3 streams have an offset in timestamps, requiring us to push the
frame *AFTER* segment.stop in order for the decoder to be able to push
all data up to the segment.stop position.

---

 gst/mpegaudioparse/gstmpegaudioparse.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c
index a7aaa68..06e6b9d 100644
--- a/gst/mpegaudioparse/gstmpegaudioparse.c
+++ b/gst/mpegaudioparse/gstmpegaudioparse.c
@@ -792,10 +792,15 @@ gst_mp3parse_emit_frame (GstMPEGAudioParse * mp3parse, guint size,
     ret = GST_FLOW_OK;
   } else if (G_UNLIKELY (GST_BUFFER_TIMESTAMP_IS_VALID (outbuf) &&
           GST_CLOCK_TIME_IS_VALID (mp3parse->segment.stop) &&
-          GST_BUFFER_TIMESTAMP (outbuf) >= mp3parse->segment.stop)) {
+          GST_BUFFER_DURATION_IS_VALID (outbuf) &&
+          GST_BUFFER_TIMESTAMP (outbuf) >=
+          mp3parse->segment.stop + GST_BUFFER_DURATION (outbuf))) {
+    /* Some mp3 streams have an offset in the timestamps, for which we have to
+     * push the frame *after* the end position in order for the decoder to be
+     * able to decode everything up until the segment.stop position */
     GST_DEBUG_OBJECT (mp3parse,
-        "Buffer after configured segment range %" GST_TIME_FORMAT
-        " to %" GST_TIME_FORMAT ", returning GST_FLOW_UNEXPECTED, timestamp %"
+        "Buffer after configured segment range %" GST_TIME_FORMAT " to %"
+        GST_TIME_FORMAT ", returning GST_FLOW_UNEXPECTED, timestamp %"
         GST_TIME_FORMAT " duration %" GST_TIME_FORMAT ", offset 0x%08"
         G_GINT64_MODIFIER "x", GST_TIME_ARGS (push_start),
         GST_TIME_ARGS (mp3parse->segment.stop),





More information about the Gstreamer-commits mailing list