Revert "audiorate: accumulate offset by time diff"

This reverts commit 4fa850e3e6.

The commit would break an constant rate audio stream with gap.
This commit is contained in:
Seungha Yang 2019-11-07 21:42:25 +09:00 committed by GStreamer Merge Bot
parent b4e37d8a4b
commit b6bdff0c84
2 changed files with 5 additions and 20 deletions

View file

@ -499,21 +499,9 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
audiorate->in += in_samples; audiorate->in += in_samples;
/* calculate the buffer offset */ /* calculate the buffer offset */
if (in_time < audiorate->prev_in_time) { in_offset = gst_util_uint64_scale_int_round (in_time, rate, GST_SECOND);
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_end = in_offset + in_samples; in_offset_end = in_offset + in_samples;
audiorate->prev_in_offset = in_offset;
audiorate->prev_in_time = in_time;
GST_LOG_OBJECT (audiorate, GST_LOG_OBJECT (audiorate,
"in_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:%" ", 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' * offset to get duration. Necessary complexity to get 'perfect'
* streams */ * streams */
GST_BUFFER_TIMESTAMP (fill) = audiorate->next_ts; GST_BUFFER_TIMESTAMP (fill) = audiorate->next_ts;
audiorate->next_ts += audiorate->next_ts =
gst_util_uint64_scale_int_round (cursamples, GST_SECOND, rate); gst_util_uint64_scale_int_round (audiorate->next_offset, GST_SECOND,
rate);
GST_BUFFER_DURATION (fill) = GST_BUFFER_DURATION (fill) =
audiorate->next_ts - GST_BUFFER_TIMESTAMP (fill); audiorate->next_ts - GST_BUFFER_TIMESTAMP (fill);
@ -652,8 +641,7 @@ send:
GST_BUFFER_OFFSET_END (buf) = in_offset_end; GST_BUFFER_OFFSET_END (buf) = in_offset_end;
GST_BUFFER_TIMESTAMP (buf) = audiorate->next_ts; GST_BUFFER_TIMESTAMP (buf) = audiorate->next_ts;
audiorate->next_ts += audiorate->next_ts = gst_util_uint64_scale_int_round (in_offset_end,
gst_util_uint64_scale_int_round (in_offset_end - audiorate->next_offset,
GST_SECOND, rate); GST_SECOND, rate);
GST_BUFFER_DURATION (buf) = audiorate->next_ts - GST_BUFFER_TIMESTAMP (buf); GST_BUFFER_DURATION (buf) = audiorate->next_ts - GST_BUFFER_TIMESTAMP (buf);

View file

@ -63,9 +63,6 @@ struct _GstAudioRate
guint64 next_offset; guint64 next_offset;
guint64 next_ts; guint64 next_ts;
GstClockTime prev_in_time;
guint64 prev_in_offset;
gboolean discont; gboolean discont;
gboolean new_segment; gboolean new_segment;