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.)
This commit is contained in:
1 parent
47bc87208b
commit
41a5837e2b
1 file changed
+1
-2
+1
-2
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user