Commit 13b31e77 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

audiotestsrc: Fix segment boundary checking for reverse playback

parent 31dd3706
......@@ -1123,11 +1123,16 @@ gst_audio_test_src_do_seek (GstBaseSrc * basesrc, GstSegment * segment)
src->next_sample = next_sample;
if (GST_CLOCK_TIME_IS_VALID (segment->stop)) {
if (segment->rate > 0 && GST_CLOCK_TIME_IS_VALID (segment->stop)) {
time = segment->stop;
src->sample_stop =
gst_util_uint64_scale_round (time, samplerate, GST_SECOND);
src->check_seek_stop = TRUE;
} else if (segment->rate < 0) {
time = segment->start;
src->sample_stop =
gst_util_uint64_scale_round (time, samplerate, GST_SECOND);
src->check_seek_stop = TRUE;
} else {
src->check_seek_stop = FALSE;
}
......@@ -1202,7 +1207,7 @@ gst_audio_test_src_fill (GstBaseSrc * basesrc, guint64 offset,
}
/* check for eos */
if (src->check_seek_stop &&
if (src->check_seek_stop && !src->reverse &&
(src->sample_stop > src->next_sample) &&
(src->sample_stop < src->next_sample + samples)
) {
......@@ -1210,6 +1215,13 @@ gst_audio_test_src_fill (GstBaseSrc * basesrc, guint64 offset,
src->generate_samples_per_buffer = src->sample_stop - src->next_sample;
next_sample = src->sample_stop;
src->eos_reached = TRUE;
} else if (src->check_seek_stop && src->reverse &&
(src->sample_stop > src->next_sample)
) {
/* calculate only partial buffer */
src->generate_samples_per_buffer = src->sample_stop - src->next_sample;
next_sample = src->sample_stop;
src->eos_reached = TRUE;
} else {
/* calculate full buffer */
src->generate_samples_per_buffer = samples;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment