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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 ALOGD << "MediaCodecVideoDecoderFactory dtor"; | 889 ALOGD << "MediaCodecVideoDecoderFactory dtor"; |
890 if (egl_context_) { | 890 if (egl_context_) { |
891 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 891 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
892 jni->DeleteGlobalRef(egl_context_); | 892 jni->DeleteGlobalRef(egl_context_); |
893 } | 893 } |
894 } | 894 } |
895 | 895 |
896 void MediaCodecVideoDecoderFactory::SetEGLContext( | 896 void MediaCodecVideoDecoderFactory::SetEGLContext( |
897 JNIEnv* jni, jobject egl_context) { | 897 JNIEnv* jni, jobject egl_context) { |
898 ALOGD << "MediaCodecVideoDecoderFactory::SetEGLContext"; | 898 ALOGD << "MediaCodecVideoDecoderFactory::SetEGLContext"; |
899 RTC_DCHECK(!egl_context_); | 899 if (egl_context_) { |
| 900 jni->DeleteGlobalRef(egl_context_); |
| 901 egl_context_ = nullptr; |
| 902 } |
900 egl_context_ = jni->NewGlobalRef(egl_context); | 903 egl_context_ = jni->NewGlobalRef(egl_context); |
901 if (CheckException(jni)) { | 904 if (CheckException(jni)) { |
902 ALOGE << "error calling NewGlobalRef for EGL Context."; | 905 ALOGE << "error calling NewGlobalRef for EGL Context."; |
903 } | 906 } |
904 } | 907 } |
905 | 908 |
906 webrtc::VideoDecoder* MediaCodecVideoDecoderFactory::CreateVideoDecoder( | 909 webrtc::VideoDecoder* MediaCodecVideoDecoderFactory::CreateVideoDecoder( |
907 VideoCodecType type) { | 910 VideoCodecType type) { |
908 if (supported_codec_types_.empty()) { | 911 if (supported_codec_types_.empty()) { |
909 ALOGW << "No HW video decoder for type " << (int)type; | 912 ALOGW << "No HW video decoder for type " << (int)type; |
(...skipping 15 matching lines...) Expand all Loading... |
925 ALOGD << "Destroy video decoder."; | 928 ALOGD << "Destroy video decoder."; |
926 delete decoder; | 929 delete decoder; |
927 } | 930 } |
928 | 931 |
929 const char* MediaCodecVideoDecoder::ImplementationName() const { | 932 const char* MediaCodecVideoDecoder::ImplementationName() const { |
930 return "MediaCodec"; | 933 return "MediaCodec"; |
931 } | 934 } |
932 | 935 |
933 } // namespace webrtc_jni | 936 } // namespace webrtc_jni |
934 | 937 |
OLD | NEW |