[FFmpeg-devel] [PATCH 19/19] avformat/hls: flush the subdemuxer when seeking

Anssi Hannula anssi.hannula at iki.fi
Fri Jan 3 15:21:43 CET 2014


Since we are basically seeking the AVIOContext under the subdemuxer, we
need to flush the subdemuxer to avoid old packets from being read from
the packet queue after the seek.

Signed-off-by: Anssi Hannula <anssi.hannula at iki.fi>
---
 libavformat/hls.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 1a67818..e18f094 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1417,6 +1417,8 @@ static int hls_read_seek(AVFormatContext *s, int stream_index,
         pls->pb.buf_end = pls->pb.buf_ptr = pls->pb.buffer;
         /* Reset the pos, to let the mpegts demuxer know we've seeked. */
         pls->pb.pos = 0;
+        /* Flush the packet queue of the subdemuxer. */
+        ff_read_frame_flush(pls->ctx);
         /* Set current segment to end immediately for audio demuxer */
         pls->next_seg_bytepos = 0;
         set_audio_id3_tag_offset(pls);
-- 
1.8.1.5



More information about the ffmpeg-devel mailing list