diff options
author | wm4 <wm4@nowhere> | 2014-02-06 14:11:12 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-06 14:11:12 +0100 |
commit | 41a5837e2b2b0daa772acbfc6656900c8a242dad (patch) | |
tree | 407a3b9535dd29b6de69a86fcbe5a5e8afc882d3 | |
parent | 47bc87208b1325398c7af6fcca3dbd54fd80c518 (diff) | |
download | mpv-41a5837e2b2b0daa772acbfc6656900c8a242dad.tar.bz2 mpv-41a5837e2b2b0daa772acbfc6656900c8a242dad.tar.xz |
demux_lavf: do metadata-from-packet update before possibly discarding it
There is some logic to discard packets from streams that are not
selected. Run the metadata update code before this, just to make 100%
sure that no metadata updates can be lost when streams are deselected.
(I'm not sure why this logic would be needed, since both libavformat and
the generic demuxer code do this already. But a quick test shows that
av_read_frame() can return a packet from a stream even if the stream has
AVStream.discard set to AVDISCARD_ALL. This happened after stream
switching. Maybe libavformat doesn't discard already queued packets.)
-rw-r--r-- | demux/demux_lavf.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 17053a5520..ad183629ff 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -706,6 +706,7 @@ static int demux_lavf_fill_buffer(demuxer_t *demux) talloc_set_destructor(pkt, destroy_avpacket); add_new_streams(demux); + update_metadata(demux, pkt); assert(pkt->stream_index >= 0 && pkt->stream_index < priv->num_streams); struct sh_stream *stream = priv->streams[pkt->stream_index]; @@ -722,8 +723,6 @@ static int demux_lavf_fill_buffer(demuxer_t *demux) if (av_dup_packet(pkt) < 0) abort(); - update_metadata(demux, pkt); - dp = new_demux_packet_fromdata(pkt->data, pkt->size); dp->avpacket = talloc_steal(dp, pkt); |