mpegpsdemux seeking stop position handling is wrong
Describe your issue
Telling a mpegpsdemux element to seek to start=0 stop=duration will emit a segment event of start=(first PTS) stop=duration, which will subsequently discard various amounts of data.
Expected Behavior
Either start=(first PTS) stop=(first PTS)+duration, or start=0 stop=duration
Observed Behavior
start=(first PTS) stop=duration
Setup
- Operating System: Debian 12
- Device: Computer / Tablet / Mobile / Virtual Machine
- GStreamer Version: 1.22.0
- Command line: Not applicable
Steps to reproduce the bug
- Acquire an mpeg file whose first PTS is greater than the file's duration, for example https://gitlab.winehq.org/wine/wine/-/raw/a240d38085631d282aa218618aaab28c25b95e73/dlls/quartz/tests/test.mpg
- Compile and run this program with GST_DEBUG=1 or higher
0:00:00.015903585 1077832 0x561cc240f6a0 ERROR default a.c:42:main: initial play
0:00:00.016485410 1077832 0x561cc225cb60 ERROR default a.c:18:fakesink_buffer_handler: fakesink 1214
0:00:00.016677124 1077832 0x561cc240f6a0 ERROR default a.c:50:main: time segment start=0:00:00.540000000, offset=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x00, time=0:00:00.540000000, base=0:00:00.000000000, position 0:00:00.540000000, duration 0:00:00.119700000
0:00:00.016688884 1077832 0x561cc240f6a0 ERROR default a.c:52:main: seek with end=inf
0:00:00.017000327 1077832 0x561cc225cb60 ERROR default a.c:18:fakesink_buffer_handler: fakesink 1214
0:00:00.017118745 1077832 0x561cc240f6a0 ERROR default a.c:56:main: time segment start=0:00:00.540000000, offset=0:00:00.000000000, stop=99:99:99.999999999, rate=1.000000, applied_rate=1.000000, flags=0x01, time=0:00:00.540000000, base=0:00:00.000000000, position 0:00:00.540000000, duration 0:00:00.119700000
0:00:00.017129751 1077832 0x561cc240f6a0 ERROR default a.c:58:main: seek with end=duration
0:00:00.017431621 1077832 0x561cc240f6a0 ERROR default a.c:64:main: time segment start=0:00:00.540000000, offset=0:00:00.000000000, stop=0:00:00.119700000, rate=1.000000, applied_rate=1.000000, flags=0x01, time=0:00:00.540000000, base=0:00:00.000000000, position 0:00:00.540000000, duration 0:00:00.119700000
Note how start plus duration is not stop in the last one. In fact, start is after stop. Note also how the fakesink reports no input for that one.
How reproducible is the bug?
Always