| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 ALOGE << "Release failure: " << ret_val << " - fallback to SW codec"; | 311 ALOGE << "Release failure: " << ret_val << " - fallback to SW codec"; |
| 312 sw_fallback_required_ = true; | 312 sw_fallback_required_ = true; |
| 313 return WEBRTC_VIDEO_CODEC_ERROR; | 313 return WEBRTC_VIDEO_CODEC_ERROR; |
| 314 } | 314 } |
| 315 | 315 |
| 316 // Always start with a complete key frame. | 316 // Always start with a complete key frame. |
| 317 key_frame_required_ = true; | 317 key_frame_required_ = true; |
| 318 frames_received_ = 0; | 318 frames_received_ = 0; |
| 319 frames_decoded_ = 0; | 319 frames_decoded_ = 0; |
| 320 | 320 |
| 321 jobject java_surface_texture_helper_ = nullptr; |
| 321 if (use_surface_) { | 322 if (use_surface_) { |
| 323 java_surface_texture_helper_ = jni->CallStaticObjectMethod( |
| 324 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), |
| 325 GetStaticMethodID(jni, |
| 326 FindClass(jni, "org/webrtc/SurfaceTextureHelper"), |
| 327 "create", |
| 328 "(Lorg/webrtc/EglBase$Context;)" |
| 329 "Lorg/webrtc/SurfaceTextureHelper;"), |
| 330 render_egl_context_); |
| 331 RTC_CHECK(java_surface_texture_helper_ != nullptr); |
| 322 surface_texture_helper_ = new rtc::RefCountedObject<SurfaceTextureHelper>( | 332 surface_texture_helper_ = new rtc::RefCountedObject<SurfaceTextureHelper>( |
| 323 jni, render_egl_context_); | 333 jni, java_surface_texture_helper_); |
| 324 } | 334 } |
| 325 | 335 |
| 326 jobject j_video_codec_enum = JavaEnumFromIndex( | 336 jobject j_video_codec_enum = JavaEnumFromIndex( |
| 327 jni, "MediaCodecVideoDecoder$VideoCodecType", codecType_); | 337 jni, "MediaCodecVideoDecoder$VideoCodecType", codecType_); |
| 328 bool success = jni->CallBooleanMethod( | 338 bool success = jni->CallBooleanMethod( |
| 329 *j_media_codec_video_decoder_, | 339 *j_media_codec_video_decoder_, |
| 330 j_init_decode_method_, | 340 j_init_decode_method_, |
| 331 j_video_codec_enum, | 341 j_video_codec_enum, |
| 332 codec_.width, | 342 codec_.width, |
| 333 codec_.height, | 343 codec_.height, |
| 334 use_surface_ ? surface_texture_helper_->GetJavaSurfaceTextureHelper() | 344 java_surface_texture_helper_); |
| 335 : nullptr); | |
| 336 if (CheckException(jni) || !success) { | 345 if (CheckException(jni) || !success) { |
| 337 ALOGE << "Codec initialization error - fallback to SW codec."; | 346 ALOGE << "Codec initialization error - fallback to SW codec."; |
| 338 sw_fallback_required_ = true; | 347 sw_fallback_required_ = true; |
| 339 return WEBRTC_VIDEO_CODEC_ERROR; | 348 return WEBRTC_VIDEO_CODEC_ERROR; |
| 340 } | 349 } |
| 341 inited_ = true; | 350 inited_ = true; |
| 342 | 351 |
| 343 switch (codecType_) { | 352 switch (codecType_) { |
| 344 case kVideoCodecVP8: | 353 case kVideoCodecVP8: |
| 345 max_pending_frames_ = kMaxPendingFramesVp8; | 354 max_pending_frames_ = kMaxPendingFramesVp8; |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 } | 901 } |
| 893 | 902 |
| 894 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( | 903 void MediaCodecVideoDecoderFactory::DestroyVideoDecoder( |
| 895 webrtc::VideoDecoder* decoder) { | 904 webrtc::VideoDecoder* decoder) { |
| 896 ALOGD << "Destroy video decoder."; | 905 ALOGD << "Destroy video decoder."; |
| 897 delete decoder; | 906 delete decoder; |
| 898 } | 907 } |
| 899 | 908 |
| 900 } // namespace webrtc_jni | 909 } // namespace webrtc_jni |
| 901 | 910 |
| OLD | NEW |