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

Unified Diff: webrtc/api/java/jni/androidmediadecoder_jni.cc

Issue 1695763002: Replaced eglbase_jni with with holding a EglBase in PeerConnectionFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Removed bad test Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/java/jni/androidmediadecoder_jni.h ('k') | webrtc/api/java/jni/androidmediaencoder_jni.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/java/jni/androidmediadecoder_jni.cc
diff --git a/webrtc/api/java/jni/androidmediadecoder_jni.cc b/webrtc/api/java/jni/androidmediadecoder_jni.cc
index 93f253d18f2f4446ac56d21c3c470a4a203a2431..f7966cc44a86c9359d89621c9788b546d9244f27 100644
--- a/webrtc/api/java/jni/androidmediadecoder_jni.cc
+++ b/webrtc/api/java/jni/androidmediadecoder_jni.cc
@@ -843,7 +843,8 @@ void MediaCodecVideoDecoder::OnMessage(rtc::Message* msg) {
codec_thread_->PostDelayed(kMediaCodecPollMs, this);
}
-MediaCodecVideoDecoderFactory::MediaCodecVideoDecoderFactory() {
+MediaCodecVideoDecoderFactory::MediaCodecVideoDecoderFactory()
+ : egl_context_(nullptr) {
ALOGD << "MediaCodecVideoDecoderFactory ctor";
JNIEnv* jni = AttachCurrentThreadIfNeeded();
ScopedLocalRefFrame local_ref_frame(jni);
@@ -886,13 +887,19 @@ MediaCodecVideoDecoderFactory::MediaCodecVideoDecoderFactory() {
MediaCodecVideoDecoderFactory::~MediaCodecVideoDecoderFactory() {
ALOGD << "MediaCodecVideoDecoderFactory dtor";
+ if (egl_context_) {
+ JNIEnv* jni = AttachCurrentThreadIfNeeded();
+ jni->DeleteGlobalRef(egl_context_);
+ }
}
void MediaCodecVideoDecoderFactory::SetEGLContext(
- JNIEnv* jni, jobject render_egl_context) {
+ JNIEnv* jni, jobject egl_context) {
ALOGD << "MediaCodecVideoDecoderFactory::SetEGLContext";
- if (!egl_.CreateEglBase(jni, render_egl_context)) {
- ALOGW << "Invalid EGL context - HW surface decoding is disabled.";
+ RTC_DCHECK(!egl_context_);
+ egl_context_ = jni->NewGlobalRef(egl_context);
+ if (CheckException(jni)) {
+ ALOGE << "error calling NewGlobalRef for EGL Context.";
}
}
@@ -906,7 +913,7 @@ webrtc::VideoDecoder* MediaCodecVideoDecoderFactory::CreateVideoDecoder(
if (codec_type == type) {
ALOGD << "Create HW video decoder for type " << (int)type;
return new MediaCodecVideoDecoder(AttachCurrentThreadIfNeeded(), type,
- egl_.egl_base_context());
+ egl_context_);
}
}
ALOGW << "Can not find HW video decoder for type " << (int)type;
« no previous file with comments | « webrtc/api/java/jni/androidmediadecoder_jni.h ('k') | webrtc/api/java/jni/androidmediaencoder_jni.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698