From: Mark Nauwelaerts Date: Tue, 22 Mar 2011 18:35:58 +0000 (+0100) Subject: avimux: use running time for synchronization X-Git-Tag: RELEASE-0.10.29~512 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b02edfbfffbfd2bfb899e88e6d7c7ab2674c5767;p=platform%2Fupstream%2Fgst-plugins-good.git avimux: use running time for synchronization See bug #432612. --- diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index d0d2f0e..37f9291 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -1916,6 +1916,11 @@ gst_avi_mux_do_buffer (GstAviMux * avimux, GstAviPad * avipad) guint flags; data = gst_collect_pads_pop (avimux->collect, avipad->collect); + /* arrange downstream running time */ + data = gst_buffer_make_metadata_writable (data); + GST_BUFFER_TIMESTAMP (data) = + gst_segment_to_running_time (&avipad->collect->segment, + GST_FORMAT_TIME, GST_BUFFER_TIMESTAMP (data)); /* Prepend a special buffer to the first one for some formats */ if (avipad->is_video) { @@ -2042,6 +2047,19 @@ gst_avi_mux_do_one_buffer (GstAviMux * avimux) time = GST_BUFFER_TIMESTAMP (buffer); gst_buffer_unref (buffer); + /* invalid should pass */ + if (G_LIKELY (GST_CLOCK_TIME_IS_VALID (time))) { + time = gst_segment_to_running_time (&avipad->collect->segment, + GST_FORMAT_TIME, time); + if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (time))) { + GST_DEBUG_OBJECT (avimux, "clipping buffer on pad %s outside segment", + GST_PAD_NAME (avipad->collect->pad)); + buffer = gst_collect_pads_pop (avimux->collect, avipad->collect); + gst_buffer_unref (buffer); + return GST_FLOW_OK; + } + } + delay = avipad->is_video ? GST_SECOND / 2 : 0; /* invalid timestamp buffers pass first,