Skip to content

Conversation

NicolasHug
Copy link
Contributor

@NicolasHug NicolasHug commented Feb 7, 2025

This avoids receiving undesired packets when calling av_read_frame(). This saves 643 useless packets from being received on our nasa video.

I was hoping we could remove/simplify a bit our do/while

https://github.com/pytorch/torchcodec/blob/b87f00d587843f02941fc12779e72a6fef094e19/src/torchcodec/decoders/_core/VideoDecoder.cpp#L1007

and just do

TORCH_CHECK(packet->stream_index == activeStreamIndex_);'

but while most tests are passing, some still fail. I suspect FFmpeg just doesn't fully respect the DISCARD flag under some specific conditions (that I haven't investigated).

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 7, 2025
@scotts
Copy link
Contributor

scotts commented Feb 7, 2025

Great catch again!

@NicolasHug NicolasHug merged commit 6e9267b into meta-pytorch:main Feb 7, 2025
47 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants