diff options
author | Seungha Yang <seungha.yang@navercorp.com> | 2019-11-07 21:42:25 +0900 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-11-18 12:02:17 +0000 |
commit | 492415abcc743a6b44560a5d3445a23e119d9b12 (patch) | |
tree | aae50822a69bf66036bf1fc422a6138325872322 | |
parent | 3d9d3c91d351515b9178f13ac66b0ab8ff58cc25 (diff) | |
download | gstreamer-plugins-base-492415abcc743a6b44560a5d3445a23e119d9b12.tar.gz |
Revert "audiorate: accumulate offset by time diff"
This reverts commit 4fa850e3e6c039000fc7f648de238af6c2278469.
The commit would break an constant rate audio stream with gap.
-rw-r--r-- | gst/audiorate/gstaudiorate.c | 22 | ||||
-rw-r--r-- | gst/audiorate/gstaudiorate.h | 3 |
2 files changed, 5 insertions, 20 deletions
diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c index 5b981bb12..eceeed2ad 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 81eb87f6f..c7dfd2342 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; |