mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
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:
parent
b4e37d8a4b
commit
b6bdff0c84
2 changed files with 5 additions and 20 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue