diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c index 5b981bb121..eceeed2adc 100644 --- a/gst/audiorate/gstaudiorate.c +++ b/gst/audiorate/gstaudiorate.c @@ -499,21 +499,9 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) audiorate->in += in_samples; /* calculate the buffer offset */ - if (in_time < audiorate->prev_in_time) { - in_offset = audiorate->prev_in_offset - - gst_util_uint64_scale_int_round (audiorate->prev_in_time - in_time, - rate, GST_SECOND); - } else { - in_offset = - audiorate->prev_in_offset + - gst_util_uint64_scale_int_round (in_time - audiorate->prev_in_time, - rate, GST_SECOND); - } + in_offset = gst_util_uint64_scale_int_round (in_time, rate, GST_SECOND); in_offset_end = in_offset + in_samples; - audiorate->prev_in_offset = in_offset; - audiorate->prev_in_time = in_time; - GST_LOG_OBJECT (audiorate, "in_time:%" GST_TIME_FORMAT ", in_duration:%" GST_TIME_FORMAT ", in_size:%u, in_offset:%" G_GUINT64_FORMAT ", in_offset_end:%" @@ -578,8 +566,9 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) * offset to get duration. Necessary complexity to get 'perfect' * streams */ GST_BUFFER_TIMESTAMP (fill) = audiorate->next_ts; - audiorate->next_ts += - gst_util_uint64_scale_int_round (cursamples, GST_SECOND, rate); + audiorate->next_ts = + gst_util_uint64_scale_int_round (audiorate->next_offset, GST_SECOND, + rate); GST_BUFFER_DURATION (fill) = audiorate->next_ts - GST_BUFFER_TIMESTAMP (fill); @@ -652,8 +641,7 @@ send: GST_BUFFER_OFFSET_END (buf) = in_offset_end; GST_BUFFER_TIMESTAMP (buf) = audiorate->next_ts; - audiorate->next_ts += - gst_util_uint64_scale_int_round (in_offset_end - audiorate->next_offset, + audiorate->next_ts = gst_util_uint64_scale_int_round (in_offset_end, GST_SECOND, rate); GST_BUFFER_DURATION (buf) = audiorate->next_ts - GST_BUFFER_TIMESTAMP (buf); diff --git a/gst/audiorate/gstaudiorate.h b/gst/audiorate/gstaudiorate.h index 81eb87f6fe..c7dfd2342f 100644 --- a/gst/audiorate/gstaudiorate.h +++ b/gst/audiorate/gstaudiorate.h @@ -63,9 +63,6 @@ struct _GstAudioRate guint64 next_offset; guint64 next_ts; - GstClockTime prev_in_time; - guint64 prev_in_offset; - gboolean discont; gboolean new_segment;