microsoft / FFmpegInterop

This is a code sample to make it easier to use FFmpeg in Windows applications.
Apache License 2.0
1.27k stars 308 forks source link

Don't buffer packets for deselected streams #275

Closed brbeec closed 4 years ago

brbeec commented 4 years ago

For deselected streams we set AVStream::discard to AVDISCARD_ALL. However, read_frame_internal() only honors this flag and discard packets when parsing is needed (AVStream::need_parsing && AVStream::parser). It's unclear to me whether this is a bug or the desired behavior. In any case, this violates the assertion in SampleProvider::QueuePacket() that we don't queue packets for deselected streams.

I changed the assertion in SampleProvider::QueuePacket() to a hard check so that we don't unnecessarily buffer packets for deselected streams.