mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
audiotestsrc: Fix segment boundary checking for reverse playback
This commit is contained in:
parent
cf18fae9de
commit
031f256584
1 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue