End of stream situations not handled correctly (last frames are dropped)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- audio-video-rtc
Research direction
Start by locating the uncompressed sample provider and the code that stops decoding when no packet is available. Read the linked FFmpeg end-of-stream documentation, then trace how buffered decoder frames are handled. Done means the decoder is drained at end of stream so buffered frames are not dropped, with existing decoding checks still passing.
Written by the indexing model from the issue text.
Description
We currently do not handle end of stream correctly for uncompressed sample providers. The decoders might contain buffered data at end of stream, which gets discarded right now.
Please check the following from ffmpeg docs:
End of stream situations. These require "flushing" (aka draining) the codec, as the codec might buffer multiple frames or packets internally for performance or out of necessity (consider B-frames). This is handled as follows:
Instead of valid input, send NULL to the avcodec_send_packet() (decoding) or avcodec_send_frame() (encoding) functions. This will enter draining mode.
Call avcodec_receive_frame() (decoding) or avcodec_receive_packet() (encoding) in a loop until AVERROR_EOF is returned. The functions will not return AVERROR(EAGAIN), unless you forgot to enter draining mode.
Before decoding can be resumed again, the codec has to be reset with avcodec_flush_buffers().
https://www.ffmpeg.org/doxygen/3.4/group__lavc__encdec.html
Currently, we just stop decoding when we do not get a packet anymore. But instead, we have to send NULL packet to the decoder and then drain the decoder. Only then we are really at end of stream.
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 319
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/FFmpegInterop
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
microsoft/FFmpegInterop#330 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 25/100
microsoft/FFmpegInterop#327 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoft/FFmpegInterop#324 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
microsoft/FFmpegInterop#323 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
microsoft/FFmpegInterop#278 ·
All issues in microsoft/FFmpegInterop
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·