OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 ALOGD << "MediaCodecVideoEncoderFactory dtor"; | 1206 ALOGD << "MediaCodecVideoEncoderFactory dtor"; |
1207 if (egl_context_) { | 1207 if (egl_context_) { |
1208 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 1208 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
1209 jni->DeleteGlobalRef(egl_context_); | 1209 jni->DeleteGlobalRef(egl_context_); |
1210 } | 1210 } |
1211 } | 1211 } |
1212 | 1212 |
1213 void MediaCodecVideoEncoderFactory::SetEGLContext( | 1213 void MediaCodecVideoEncoderFactory::SetEGLContext( |
1214 JNIEnv* jni, jobject egl_context) { | 1214 JNIEnv* jni, jobject egl_context) { |
1215 ALOGD << "MediaCodecVideoEncoderFactory::SetEGLContext"; | 1215 ALOGD << "MediaCodecVideoEncoderFactory::SetEGLContext"; |
1216 RTC_DCHECK(!egl_context_); | 1216 if (egl_context_) { |
| 1217 jni->DeleteGlobalRef(egl_context_); |
| 1218 egl_context_ = nullptr; |
| 1219 } |
1217 egl_context_ = jni->NewGlobalRef(egl_context); | 1220 egl_context_ = jni->NewGlobalRef(egl_context); |
1218 if (CheckException(jni)) { | 1221 if (CheckException(jni)) { |
1219 ALOGE << "error calling NewGlobalRef for EGL Context."; | 1222 ALOGE << "error calling NewGlobalRef for EGL Context."; |
1220 } | 1223 } |
1221 } | 1224 } |
1222 | 1225 |
1223 webrtc::VideoEncoder* MediaCodecVideoEncoderFactory::CreateVideoEncoder( | 1226 webrtc::VideoEncoder* MediaCodecVideoEncoderFactory::CreateVideoEncoder( |
1224 VideoCodecType type) { | 1227 VideoCodecType type) { |
1225 if (supported_codecs_.empty()) { | 1228 if (supported_codecs_.empty()) { |
1226 ALOGW << "No HW video encoder for type " << (int)type; | 1229 ALOGW << "No HW video encoder for type " << (int)type; |
(...skipping 18 matching lines...) Expand all Loading... |
1245 } | 1248 } |
1246 | 1249 |
1247 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1250 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
1248 webrtc::VideoEncoder* encoder) { | 1251 webrtc::VideoEncoder* encoder) { |
1249 ALOGD << "Destroy video encoder."; | 1252 ALOGD << "Destroy video encoder."; |
1250 delete encoder; | 1253 delete encoder; |
1251 } | 1254 } |
1252 | 1255 |
1253 } // namespace webrtc_jni | 1256 } // namespace webrtc_jni |
1254 | 1257 |
OLD | NEW |