| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 j_media_codec_video_decoder_class_( | 192 j_media_codec_video_decoder_class_( |
| 193 jni, | 193 jni, |
| 194 FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")), | 194 FindClass(jni, "org/webrtc/MediaCodecVideoDecoder")), |
| 195 j_media_codec_video_decoder_( | 195 j_media_codec_video_decoder_( |
| 196 jni, | 196 jni, |
| 197 jni->NewObject(*j_media_codec_video_decoder_class_, | 197 jni->NewObject(*j_media_codec_video_decoder_class_, |
| 198 GetMethodID(jni, | 198 GetMethodID(jni, |
| 199 *j_media_codec_video_decoder_class_, | 199 *j_media_codec_video_decoder_class_, |
| 200 "<init>", | 200 "<init>", |
| 201 "()V"))) { | 201 "()V"))) { |
| 202 ScopedLocalRefFrame local_ref_frame(jni); | |
| 203 codec_thread_->SetName("MediaCodecVideoDecoder", NULL); | 202 codec_thread_->SetName("MediaCodecVideoDecoder", NULL); |
| 204 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder"; | 203 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder"; |
| 205 | 204 |
| 206 j_init_decode_method_ = GetMethodID( | 205 j_init_decode_method_ = GetMethodID( |
| 207 jni, *j_media_codec_video_decoder_class_, "initDecode", | 206 jni, *j_media_codec_video_decoder_class_, "initDecode", |
| 208 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;" | 207 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;" |
| 209 "IILorg/webrtc/SurfaceTextureHelper;)Z"); | 208 "IILorg/webrtc/SurfaceTextureHelper;)Z"); |
| 210 j_reset_method_ = | 209 j_reset_method_ = |
| 211 GetMethodID(jni, *j_media_codec_video_decoder_class_, "reset", "(II)V"); | 210 GetMethodID(jni, *j_media_codec_video_decoder_class_, "reset", "(II)V"); |
| 212 j_release_method_ = | 211 j_release_method_ = |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 | 1006 |
| 1008 webrtc::VideoDecoder* MediaCodecVideoDecoderFactory::CreateVideoDecoder( | 1007 webrtc::VideoDecoder* MediaCodecVideoDecoderFactory::CreateVideoDecoder( |
| 1009 VideoCodecType type) { | 1008 VideoCodecType type) { |
| 1010 if (supported_codec_types_.empty()) { | 1009 if (supported_codec_types_.empty()) { |
| 1011 ALOGW << "No HW video decoder for type " << (int)type; | 1010 ALOGW << "No HW video decoder for type " << (int)type; |
| 1012 return nullptr; | 1011 return nullptr; |
| 1013 } | 1012 } |
| 1014 for (VideoCodecType codec_type : supported_codec_types_) { | 1013 for (VideoCodecType codec_type : supported_codec_types_) { |
| 1015 if (codec_type == type) { | 1014 if (codec_type == type) { |
| 1016 ALOGD << "Create HW video decoder for type " << (int)type; | 1015 ALOGD << "Create HW video decoder for type " << (int)type; |
| 1017 return new MediaCodecVideoDecoder(AttachCurrentThreadIfNeeded(), type, | 1016 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
| 1018 egl_context_); | 1017 ScopedLocalRefFrame local_ref_frame(jni); |
| 1018 return new MediaCodecVideoDecoder(jni, type, egl_context_); |
| 1019 } | 1019 } |
| 1020 } | 1020 } |
| 1021 ALOGW << "Can not find HW video decoder for type " << (int)type; | 1021 ALOGW << "Can not find HW video decoder for type " << (int)type; |
| 1022 return nullptr; | 1022 return nullptr; |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( | 1025 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( |
| 1026 webrtc::VideoDecoder* decoder) { | 1026 webrtc::VideoDecoder* decoder) { |
| 1027 ALOGD << "Destroy video decoder."; | 1027 ALOGD << "Destroy video decoder."; |
| 1028 delete decoder; | 1028 delete decoder; |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 const char* MediaCodecVideoDecoder::ImplementationName() const { | 1031 const char* MediaCodecVideoDecoder::ImplementationName() const { |
| 1032 return "MediaCodec"; | 1032 return "MediaCodec"; |
| 1033 } | 1033 } |
| 1034 | 1034 |
| 1035 } // namespace webrtc_jni | 1035 } // namespace webrtc_jni |
| OLD | NEW |