summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_lavf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 3c18866312..1a16eecaf9 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -983,11 +983,12 @@ redo:
* call the new API instead of relying on av_seek_frame() to do this
* for us.
*/
- stream_drop_buffers(demuxer->stream);
- avio_flush(priv->avfc->pb);
av_seek_frame(priv->avfc, 0, stream_tell(demuxer->stream),
AVSEEK_FLAG_BYTE);
- avio_flush(priv->avfc->pb);
+ // 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;
+ stream_drop_buffers(demuxer->stream);
return DEMUXER_CTRL_OK;
default:
return DEMUXER_CTRL_NOTIMPL;