summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demux/demux_disc.c6
-rw-r--r--demux/demux_lavf.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/demux/demux_disc.c b/demux/demux_disc.c
index 5175f89e01..f0ddc1e827 100644
--- a/demux/demux_disc.c
+++ b/demux/demux_disc.c
@@ -310,6 +310,12 @@ static int d_open(demuxer_t *demuxer, enum demux_check check)
// Can be seekable even if the stream isn't.
demuxer->seekable = true;
+ // With cache enabled, the stream can be seekable. This causes demux_lavf.c
+ // (actually libavformat/mpegts.c) to seek sometimes when reading a packet.
+ // It does this to seek back a bit in case the current file position points
+ // into the middle of a packet.
+ demuxer->stream->seekable = false;
+
add_dvd_streams(demuxer);
add_streams(demuxer);
add_stream_chapters(demuxer);
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 578e061d46..8dd248aec1 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -1014,7 +1014,7 @@ redo:
AVSEEK_FLAG_BYTE);
// avio_flush() is designed for write-only streams, and does the wrong
// thing when reading. Flush it manually instead.
- priv->avfc->pb->buf_ptr = priv->avfc->pb->buf_end;
+ priv->avfc->pb->buf_ptr = priv->avfc->pb->buf_end = priv->avfc->pb->buffer;
stream_drop_buffers(demuxer->stream);
return DEMUXER_CTRL_OK;
default: