Skip to content

Keep decoded frames when a packet ends with undecodable bytes#2303

Merged
WyattBlue merged 1 commit into
mainfrom
patch
Jun 14, 2026
Merged

Keep decoded frames when a packet ends with undecodable bytes#2303
WyattBlue merged 1 commit into
mainfrom
patch

Conversation

@WyattBlue

Copy link
Copy Markdown
Member

A single packet may contain a valid frame followed by undecodable bytes FFmpeg yields the good frame and only reports the error on the next receive, but decode() raised InvalidDataError before returning, discarding frames it had already decoded.

Catch the error in the receive loop and return what was decoded, only re-raising when no frame was produced at all.

Fixes #2044

A single packet may contain a valid frame followed by undecodable bytes
FFmpeg yields the good frame and only reports the error on the next
receive, but decode() raised InvalidDataError before returning,
discarding frames it had already decoded.

Catch the error in the receive loop and return what was decoded, only
re-raising when no frame was produced at all.

Fixes #2044
@WyattBlue WyattBlue merged commit db104c8 into main Jun 14, 2026
7 checks passed
@WyattBlue WyattBlue deleted the patch branch June 14, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FLAC decoder loses last frame data when final frame is incomplete/corrupted

1 participant