diff options
Diffstat (limited to 'gst/audiorate/gstaudiorate.c')
-rw-r--r-- | gst/audiorate/gstaudiorate.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c index a0818c919..9ac5beb80 100644 --- a/gst/audiorate/gstaudiorate.c +++ b/gst/audiorate/gstaudiorate.c @@ -445,7 +445,7 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) * buffer in that segment, which is the offset expressed in DEFAULT units. */ /* convert first timestamp of segment to sample position */ - pos = gst_util_uint64_scale_int (audiorate->src_segment.start, + pos = gst_util_uint64_scale_int_round (audiorate->src_segment.start, GST_AUDIO_INFO_RATE (&audiorate->info), GST_SECOND); GST_DEBUG_OBJECT (audiorate, "resync to offset %" G_GINT64_FORMAT, pos); @@ -454,12 +454,13 @@ gst_audio_rate_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) audiorate->discont = TRUE; audiorate->next_offset = pos; - audiorate->next_ts = gst_util_uint64_scale_int (audiorate->next_offset, - GST_SECOND, GST_AUDIO_INFO_RATE (&audiorate->info)); + audiorate->next_ts = + gst_util_uint64_scale_int_round (audiorate->next_offset, GST_SECOND, + GST_AUDIO_INFO_RATE (&audiorate->info)); if (audiorate->skip_to_first && GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { GST_DEBUG_OBJECT (audiorate, "but skipping to first buffer instead"); - pos = gst_util_uint64_scale_int (GST_BUFFER_TIMESTAMP (buf), + pos = gst_util_uint64_scale_int_round (GST_BUFFER_TIMESTAMP (buf), GST_AUDIO_INFO_RATE (&audiorate->info), GST_SECOND); GST_DEBUG_OBJECT (audiorate, "so resync to offset %" G_GINT64_FORMAT, pos); @@ -539,10 +540,11 @@ 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 (audiorate->next_offset, - GST_SECOND, rate); - GST_BUFFER_DURATION (fill) = audiorate->next_ts - - GST_BUFFER_TIMESTAMP (fill); + 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); /* we created this buffer to fill a gap */ GST_BUFFER_FLAG_SET (fill, GST_BUFFER_FLAG_GAP); @@ -621,7 +623,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 (in_offset_end, + 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); |