From 96467f581e2d51842ab33a8e3688879229fdeef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Mon, 1 Mar 2021 16:23:09 +0100 Subject: [PATCH] mpegpsdemux: avoid early EOS In a case of a scr different from 0, after a seek, the src_segment.stop has been updated with the duration not including the base_time (scr). The segment position needs to be tested upon segment.stop + base_time (scr) to check for an EOS. Part-of: --- gst/mpegdemux/gstmpegdemux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c index fbf7b6e34b..6bd2552061 100644 --- a/gst/mpegdemux/gstmpegdemux.c +++ b/gst/mpegdemux/gstmpegdemux.c @@ -2980,9 +2980,11 @@ gst_ps_demux_loop (GstPad * pad) offset += size; gst_segment_set_position (&demux->sink_segment, GST_FORMAT_BYTES, offset); /* check EOS condition */ + /* FIXME: The src_segment.stop is not including the SCR after seek(set) */ if ((demux->sink_segment.position >= demux->sink_segment.stop) || (demux->src_segment.stop != (guint64) - 1 && - demux->src_segment.position >= demux->src_segment.stop)) { + demux->src_segment.position >= + demux->src_segment.stop + demux->base_time)) { GST_DEBUG_OBJECT (demux, "forward mode using segment reached end of " "segment pos %" GST_TIME_FORMAT " stop %" GST_TIME_FORMAT " pos in bytes %"