Skip to content

Commit

Permalink
Cherry pick PR youtube#2774: Delete the callback before the mMediaCod…
Browse files Browse the repository at this point in the history
…ec is set to null. (youtube#2779)

Refer to the original PR: youtube#2774

There is a race condition that the callback is triggered after
mMediaCodec is set to null.

b/331835987

Co-authored-by: Colin Liang <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and zhongqiliang committed Mar 29, 2024
1 parent ef9ccf7 commit 24c9165
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,9 @@ public static void createVideoMediaCodecBridge(
@UsedByNative
public void release() {
try {
mMediaCodec.setCallback(null);
mCallback = null;

String codecName = mMediaCodec.getName();
Log.w(TAG, "calling MediaCodec.release() on " + codecName);
mMediaCodec.release();
Expand Down

0 comments on commit 24c9165

Please sign in to comment.