Skip to content

fix: make decoder QP parsing flag atomic and give up codec calls without a JNI frame - #515

Merged
devopvoid merged 1 commit into
mainfrom
fix/decoder-qp-race
Nov 1, 2026
Merged

devopvoid merged 1 commit into
mainfrom
fix/decoder-qp-race

Conversation

@devopvoid

Copy link
Copy Markdown
Owner
  • VideoDecoderWrapper::qpParsingEnabled is read in Decode while a Java decoder that delivers frames from its own thread writes it in OnDecodedFrame; it is now atomic.
  • A failed PushLocalFrame no longer clears the OutOfMemoryError silently. JavaLocalFrame reports it like other codec exceptions and exposes pushed(), and every codec call gives up before making local references. release still runs, since skipping it would keep the Java codec's resources, and deletes its one reference itself. Encode drops the frame instead of failing, because WebRTC switches away from an encoder whose Encode fails.
  • New asyncJavaDecoderRoundTrips test with a decoder that hands frames over on its own thread, alternating with and without QP.

…out a JNI frame

qpParsingEnabled is written from the Java decoder's output thread while
Decode reads it, so it is now atomic. A failed PushLocalFrame no longer
clears the OutOfMemoryError silently: it is reported like other codec
exceptions and the call gives up, except release, which still runs and
frees its one reference itself. Encode drops the frame instead of
failing, since WebRTC switches away from an encoder that fails.
@devopvoid
devopvoid merged commit bd2b921 into main Nov 1, 2026
21 of 22 checks passed
@devopvoid
devopvoid deleted the fix/decoder-qp-race branch November 1, 2026 22:04
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.

1 participant