audiotestsrc: Fix the way we compute EOS in reverse playback
authorThibault Saunier <tsaunier@igalia.com>
Sat, 23 May 2020 03:24:55 +0000 (23:24 -0400)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 25 May 2020 08:19:02 +0000 (08:19 +0000)
commitb46718b1a041250a24dec339473e5da51a569bc8
tree84dc3cc4317f68e48056e3888aa830e8325b0a4f
parenteed54928c8f9cb08164c66993a44ba0d696eac5e
audiotestsrc: Fix the way we compute EOS in reverse playback

In reverse playback we were not taking into account the current buffer
samples to check if we had reached EOS which was leading to a buffer
with PTS = CLOCK_TIME_NONE containing too many frames followed by a
useless buffer with pts=0 duration=0, and a g_critical issue in
gst_object_sync_values.

Also add a validate based test case.
Without that patch this is how the expectation fails:

``` diff
--- log-asink-sink-expected       2020-05-22 23:22:42.654384579 -0400
+++ log-asink-sink-actual  2020-05-22 23:29:35.671586380 -0400
@@ -27,5 +27,6 @@
 buffer: pts=0:00:00.058820861, due=0:00:00.023219955, flags=discont
 buffer: pts=0:00:00.035600907, due=0:00:00.023219954, flags=discont
 buffer: pts=0:00:00.012380952, due=0:00:00.023219955, flags=discont
-buffer: pts=0:00:00.000000000, due=0:00:00.012380952, flags=discont
+buffer: due=0:00:00.012380953, flags=discont
+buffer: pts=0:00:00.000000000, flags=discont
 event eos: (no structure)
 ```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/667>
gst/audiotestsrc/gstaudiotestsrc.c
meson_options.txt
tests/check/meson.build
tests/meson.build
tests/validate/audiotestsrc/reverse.validatetest [new file with mode: 0644]
tests/validate/audiotestsrc/reverse/flow-expectations/log-asink-sink-expected [new file with mode: 0644]
tests/validate/meson.build [new file with mode: 0644]