From f18d2a5a9a27de45539089b2f3a38bddf74cd784 Mon Sep 17 00:00:00 2001 From: Simon Berg Date: Sun, 24 Mar 2013 20:44:58 +0000 Subject: [PATCH] audiotestsrc: fix rounding errors that might cause segments to be one sample too short https://bugzilla.gnome.org/show_bug.cgi?id=676884 --- gst/audiotestsrc/gstaudiotestsrc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gst/audiotestsrc/gstaudiotestsrc.c b/gst/audiotestsrc/gstaudiotestsrc.c index cfabbf17e9..f020aaf750 100644 --- a/gst/audiotestsrc/gstaudiotestsrc.c +++ b/gst/audiotestsrc/gstaudiotestsrc.c @@ -1065,7 +1065,7 @@ gst_audio_test_src_do_seek (GstBaseSrc * basesrc, GstSegment * segment) bpf = GST_AUDIO_INFO_BPF (&src->info); /* now move to the time indicated */ - src->next_sample = gst_util_uint64_scale_int (time, samplerate, GST_SECOND); + src->next_sample = gst_util_uint64_scale_round (time, samplerate, GST_SECOND); src->next_byte = src->next_sample * bpf; if (samplerate == 0) src->next_time = 0; @@ -1091,7 +1091,8 @@ gst_audio_test_src_do_seek (GstBaseSrc * basesrc, GstSegment * segment) if (GST_CLOCK_TIME_IS_VALID (segment->stop)) { time = segment->stop; - src->sample_stop = gst_util_uint64_scale_int (time, samplerate, GST_SECOND); + src->sample_stop = + gst_util_uint64_scale_round (time, samplerate, GST_SECOND); src->check_seek_stop = TRUE; } else { src->check_seek_stop = FALSE;