| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 *j_media_codec_video_decoder_class_, | 184 *j_media_codec_video_decoder_class_, |
| 185 "<init>", | 185 "<init>", |
| 186 "()V"))) { | 186 "()V"))) { |
| 187 ScopedLocalRefFrame local_ref_frame(jni); | 187 ScopedLocalRefFrame local_ref_frame(jni); |
| 188 codec_thread_->SetName("MediaCodecVideoDecoder", NULL); | 188 codec_thread_->SetName("MediaCodecVideoDecoder", NULL); |
| 189 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder"; | 189 RTC_CHECK(codec_thread_->Start()) << "Failed to start MediaCodecVideoDecoder"; |
| 190 | 190 |
| 191 j_init_decode_method_ = GetMethodID( | 191 j_init_decode_method_ = GetMethodID( |
| 192 jni, *j_media_codec_video_decoder_class_, "initDecode", | 192 jni, *j_media_codec_video_decoder_class_, "initDecode", |
| 193 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;" | 193 "(Lorg/webrtc/MediaCodecVideoDecoder$VideoCodecType;" |
| 194 "IILandroid/opengl/EGLContext;)Z"); | 194 "IILjavax/microedition/khronos/egl/EGLContext;)Z"); |
| 195 j_release_method_ = | 195 j_release_method_ = |
| 196 GetMethodID(jni, *j_media_codec_video_decoder_class_, "release", "()V"); | 196 GetMethodID(jni, *j_media_codec_video_decoder_class_, "release", "()V"); |
| 197 j_dequeue_input_buffer_method_ = GetMethodID( | 197 j_dequeue_input_buffer_method_ = GetMethodID( |
| 198 jni, *j_media_codec_video_decoder_class_, "dequeueInputBuffer", "()I"); | 198 jni, *j_media_codec_video_decoder_class_, "dequeueInputBuffer", "()I"); |
| 199 j_queue_input_buffer_method_ = GetMethodID( | 199 j_queue_input_buffer_method_ = GetMethodID( |
| 200 jni, *j_media_codec_video_decoder_class_, "queueInputBuffer", "(IIJ)Z"); | 200 jni, *j_media_codec_video_decoder_class_, "queueInputBuffer", "(IIJ)Z"); |
| 201 j_dequeue_output_buffer_method_ = GetMethodID( | 201 j_dequeue_output_buffer_method_ = GetMethodID( |
| 202 jni, *j_media_codec_video_decoder_class_, "dequeueOutputBuffer", | 202 jni, *j_media_codec_video_decoder_class_, "dequeueOutputBuffer", |
| 203 "(I)Ljava/lang/Object;"); | 203 "(I)Ljava/lang/Object;"); |
| 204 j_return_decoded_byte_buffer_method_ = | 204 j_return_decoded_byte_buffer_method_ = |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 if (render_egl_context_) { | 808 if (render_egl_context_) { |
| 809 jni->DeleteGlobalRef(render_egl_context_); | 809 jni->DeleteGlobalRef(render_egl_context_); |
| 810 render_egl_context_ = NULL; | 810 render_egl_context_ = NULL; |
| 811 } | 811 } |
| 812 if (!IsNull(jni, render_egl_context)) { | 812 if (!IsNull(jni, render_egl_context)) { |
| 813 render_egl_context_ = jni->NewGlobalRef(render_egl_context); | 813 render_egl_context_ = jni->NewGlobalRef(render_egl_context); |
| 814 if (CheckException(jni)) { | 814 if (CheckException(jni)) { |
| 815 ALOGE << "error calling NewGlobalRef for EGL Context."; | 815 ALOGE << "error calling NewGlobalRef for EGL Context."; |
| 816 render_egl_context_ = NULL; | 816 render_egl_context_ = NULL; |
| 817 } else { | 817 } else { |
| 818 jclass j_egl_context_class = FindClass(jni, "android/opengl/EGLContext"); | 818 jclass j_egl_context_class = |
| 819 FindClass(jni, "javax/microedition/khronos/egl/EGLContext"); |
| 819 if (!jni->IsInstanceOf(render_egl_context_, j_egl_context_class)) { | 820 if (!jni->IsInstanceOf(render_egl_context_, j_egl_context_class)) { |
| 820 ALOGE << "Wrong EGL Context."; | 821 ALOGE << "Wrong EGL Context."; |
| 821 jni->DeleteGlobalRef(render_egl_context_); | 822 jni->DeleteGlobalRef(render_egl_context_); |
| 822 render_egl_context_ = NULL; | 823 render_egl_context_ = NULL; |
| 823 } | 824 } |
| 824 } | 825 } |
| 825 } | 826 } |
| 826 if (render_egl_context_ == NULL) { | 827 if (render_egl_context_ == NULL) { |
| 827 ALOGW << "NULL VideoDecoder EGL context - HW surface decoding is disabled."; | 828 ALOGW << "NULL VideoDecoder EGL context - HW surface decoding is disabled."; |
| 828 } | 829 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 846 } | 847 } |
| 847 | 848 |
| 848 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( | 849 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( |
| 849 webrtc::VideoDecoder* decoder) { | 850 webrtc::VideoDecoder* decoder) { |
| 850 ALOGD << "Destroy video decoder."; | 851 ALOGD << "Destroy video decoder."; |
| 851 delete decoder; | 852 delete decoder; |
| 852 } | 853 } |
| 853 | 854 |
| 854 } // namespace webrtc_jni | 855 } // namespace webrtc_jni |
| 855 | 856 |
| OLD | NEW |