summaryrefslogtreecommitdiff
path: root/libavformat/hls.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2012-01-20 16:29:09 +0200
committerMartin Storsjö <martin@martin.st>2012-02-20 11:10:02 +0200
commita4f97be1a9ed80f47ca93ebfc5faaaba658250c9 (patch)
tree0d199e37a45c495fbeecff3dadbfd1bae24e06dc /libavformat/hls.c
parent55fd7da10739bb0072664e5083d33f4778fd5413 (diff)
hls: Reset the AVIOContext when seeking
This avoids reading any old data in the AVIOContext buffer after the seek, and indicates to the mpegts demuxer that we've seeked, avoiding continuity check errors. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r--libavformat/hls.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c
index c4046f29c6..e876735468 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -708,6 +708,10 @@ static int hls_read_seek(AVFormatContext *s, int stream_index,
av_free_packet(&var->pkt);
reset_packet(&var->pkt);
var->pb.eof_reached = 0;
+ /* Clear any buffered data */
+ var->pb.buf_end = var->pb.buf_ptr = var->pb.buffer;
+ /* Reset the pos, to let the mpegts demuxer know we've seeked. */
+ var->pb.pos = 0;
/* Locate the segment that contains the target timestamp */
for (j = 0; j < var->n_segments; j++) {