From 39451732e905e5884a04e040a9d47d8f4a47025c Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 29 Sep 2014 17:49:26 +0200 Subject: demux_disc: bluray: potentially fix some aspects of seeking When flushing the AVIOContext, make sure it can't seek back to discarded data. buf_ptr is just the current read position, while buf_end - buffer is the actual buffer size. Since mpegts.c is littered with seek calls, it might be that the ability to seek could read Mark the stream (which the demuxer uses) as not seekable. The cache can enable seeking again (this behavior is sometimes useful for other things). I think this should have had no bad influence in theory, since seeking BD/DVD first does the "real" seek, then flushes libavformat and reads new packets. --- demux/demux_lavf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'demux/demux_lavf.c') 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: -- cgit v1.2.3