From a11a1858ed65000a0d0c47e3e2bacadf750543f3 Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 15 Dec 2009 19:29:29 +0100 Subject: [PATCH] audiorate: fix segment handling Do not compare a media (buffer) time to a (bogus) running time (or their offset equivalents). --- gst/audiorate/gstaudiorate.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c index 7679b69b70..abe4d8204f 100644 --- a/gst/audiorate/gstaudiorate.c +++ b/gst/audiorate/gstaudiorate.c @@ -475,7 +475,7 @@ static GstFlowReturn gst_audio_rate_chain (GstPad * pad, GstBuffer * buf) { GstAudioRate *audiorate; - GstClockTime in_time, run_time; + GstClockTime in_time; guint64 in_offset, in_offset_end, in_samples; guint in_size; GstFlowReturn ret = GST_FLOW_OK; @@ -520,20 +520,16 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf) in_size = GST_BUFFER_SIZE (buf); in_samples = in_size / audiorate->bytes_per_sample; - /* Figure out the total accumulated segment time. */ - run_time = in_time + audiorate->src_segment.accum; - /* calculate the buffer offset */ - in_offset = gst_util_uint64_scale_int_round (run_time, audiorate->rate, + in_offset = gst_util_uint64_scale_int_round (in_time, audiorate->rate, GST_SECOND); in_offset_end = in_offset + in_samples; GST_LOG_OBJECT (audiorate, - "in_time:%" GST_TIME_FORMAT ", run_time:%" GST_TIME_FORMAT - ", in_duration:%" GST_TIME_FORMAT + "in_time:%" GST_TIME_FORMAT ", in_duration:%" GST_TIME_FORMAT ", in_size:%u, in_offset:%" G_GUINT64_FORMAT ", in_offset_end:%" G_GUINT64_FORMAT ", ->next_offset:%" G_GUINT64_FORMAT, - GST_TIME_ARGS (in_time), GST_TIME_ARGS (run_time), + GST_TIME_ARGS (in_time), GST_TIME_ARGS (GST_FRAMES_TO_CLOCK_TIME (in_samples, audiorate->rate)), in_size, in_offset, in_offset_end, audiorate->next_offset);