demux_lavf: fix null derefence of stream variable

demux_stream_is_selected() already checks if stream is valid, so move
the image format hack check after that.

Fixes: 4ef7931266
This commit is contained in:
Kacper Michajłow 2024-06-15 05:21:36 +02:00
parent ab0a50874b
commit 6c908363cd
1 changed files with 5 additions and 5 deletions

View File

@ -1260,17 +1260,17 @@ static bool demux_lavf_read_packet(struct demuxer *demux,
struct sh_stream *stream = info->sh;
AVStream *st = priv->avfc->streams[pkt->stream_index];
if (!demux_stream_is_selected(stream)) {
av_packet_unref(pkt);
return true; // don't signal EOF if skipping a packet
}
// Never send additional frames for streams that are a single frame.
if (stream->image && priv->format_hack.first_frame_only && pkt->pos != 0) {
av_packet_unref(pkt);
return true;
}
if (!demux_stream_is_selected(stream)) {
av_packet_unref(pkt);
return true; // don't signal EOF if skipping a packet
}
struct demux_packet *dp = new_demux_packet_from_avpacket(pkt);
if (!dp) {
av_packet_unref(pkt);