From ddcd0e60b100a17955a902f13bd6f03b734cc08a Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 8 Sep 2009 09:20:00 +0200 Subject: [PATCH] mpegtsdemux: Reset stream->last_time when flushing. This fixes naive seeking a tiny bit (by basically hinting at _data_cb that it shouldn't expect the incoming buffers to be the ones just after the previous ones). Without this, seeking by more than 10mins forward would just end up in an endless loop. --- gst/mpegdemux/gstmpegtsdemux.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c index f220896b02..cf990b0923 100644 --- a/gst/mpegdemux/gstmpegtsdemux.c +++ b/gst/mpegdemux/gstmpegtsdemux.c @@ -2543,6 +2543,7 @@ gst_mpegts_demux_src_event (GstPad * pad, GstEvent * event) static void gst_mpegts_demux_flush (GstMpegTSDemux * demux, gboolean discard) { + gint i; GstMpegTSStream *PCR_stream; GstMpegTSStream *PMT_stream; @@ -2568,6 +2569,15 @@ gst_mpegts_demux_flush (GstMpegTSDemux * demux, gboolean discard) PCR_stream->last_PCR = -1; + /* Reset last time of all streams */ + for (i = 0; i < MPEGTS_MAX_PID + 1; i++) { + GstMpegTSStream *stream = demux->streams[i]; + + if (stream) + stream->last_time = 0; + } + + beach: return; }