Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Issue 2627973004: Fix JNI reference leak in MediaCodecVideoEncoder (Closed)

Created:
3 years, 11 months ago by magjed_webrtc
Modified:
3 years, 11 months ago
Reviewers:
sakal
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, AlexG
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Fix JNI reference leak in MediaCodecVideoEncoder We currently leak one local reference to MediaCodecVideoEncoder in every call to MediaCodecVideoEncoderFactory::CreateVideoEncoder. After the encoder has been re-initialized 512 times, JNI will crash due to local reference table overflow (max=512). The actual leak is in the member initializer list of MediaCodecVideoEncoder. This CL fixes the leak by adding a ScopedLocalRefFrame outside of the ctor. All JNI code that originate from a C++ thread (i.e. the entry point is not a Java thread) must use a ScopedLocalRefFrame in order to avoid leaking local references. BUG=webrtc:6969 ,b/34056152 Review-Url: https://codereview.webrtc.org/2627973004 Cr-Commit-Position: refs/heads/master@{#16034} Committed: https://chromium.googlesource.com/external/webrtc/+/b66129a27efd44198e4a73a27268ae17032bb617

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -3 lines) Patch
M webrtc/sdk/android/src/jni/androidmediaencoder_jni.cc View 2 chunks +3 lines, -3 lines 0 comments Download

Messages

Total messages: 14 (10 generated)
magjed_webrtc
Sami - please take a look.
3 years, 11 months ago (2017-01-12 13:22:47 UTC) #4
sakal
lgtm
3 years, 11 months ago (2017-01-12 14:47:06 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2627973004/1
3 years, 11 months ago (2017-01-12 14:48:42 UTC) #11
commit-bot: I haz the power
3 years, 11 months ago (2017-01-12 14:51:04 UTC) #14
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://chromium.googlesource.com/external/webrtc/+/b66129a27efd44198e4a73a27...

Powered by Google App Engine
This is Rietveld 408576698