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>
| ... | ... |
@@ -708,6 +708,10 @@ static int hls_read_seek(AVFormatContext *s, int stream_index, |
| 708 | 708 |
av_free_packet(&var->pkt); |
| 709 | 709 |
reset_packet(&var->pkt); |
| 710 | 710 |
var->pb.eof_reached = 0; |
| 711 |
+ /* Clear any buffered data */ |
|
| 712 |
+ var->pb.buf_end = var->pb.buf_ptr = var->pb.buffer; |
|
| 713 |
+ /* Reset the pos, to let the mpegts demuxer know we've seeked. */ |
|
| 714 |
+ var->pb.pos = 0; |
|
| 711 | 715 |
|
| 712 | 716 |
/* Locate the segment that contains the target timestamp */ |
| 713 | 717 |
for (j = 0; j < var->n_segments; j++) {
|