Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: webrtc/api/java/jni/androidmediadecoder_jni.cc

Issue 1783793002: VideoCapturer: Update interface (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Release previous codec first if it was allocated before. 336 // Release previous codec first if it was allocated before.
337 int ret_val = ReleaseOnCodecThread(); 337 int ret_val = ReleaseOnCodecThread();
338 if (ret_val < 0) { 338 if (ret_val < 0) {
339 ALOGE << "Release failure: " << ret_val << " - fallback to SW codec"; 339 ALOGE << "Release failure: " << ret_val << " - fallback to SW codec";
340 sw_fallback_required_ = true; 340 sw_fallback_required_ = true;
341 return WEBRTC_VIDEO_CODEC_ERROR; 341 return WEBRTC_VIDEO_CODEC_ERROR;
342 } 342 }
343 343
344 ResetVariables(); 344 ResetVariables();
345 345
346 jobject java_surface_texture_helper_ = nullptr;
347 if (use_surface_) { 346 if (use_surface_) {
348 java_surface_texture_helper_ = jni->CallStaticObjectMethod(
349 FindClass(jni, "org/webrtc/SurfaceTextureHelper"),
350 GetStaticMethodID(jni,
351 FindClass(jni, "org/webrtc/SurfaceTextureHelper"),
352 "create",
353 "(Lorg/webrtc/EglBase$Context;)"
354 "Lorg/webrtc/SurfaceTextureHelper;"),
355 render_egl_context_);
356 RTC_CHECK(java_surface_texture_helper_ != nullptr);
357 surface_texture_helper_ = new rtc::RefCountedObject<SurfaceTextureHelper>( 347 surface_texture_helper_ = new rtc::RefCountedObject<SurfaceTextureHelper>(
358 jni, java_surface_texture_helper_); 348 jni, render_egl_context_);
359 } 349 }
360 350
361 jobject j_video_codec_enum = JavaEnumFromIndexAndClassName( 351 jobject j_video_codec_enum = JavaEnumFromIndexAndClassName(
362 jni, "MediaCodecVideoDecoder$VideoCodecType", codecType_); 352 jni, "MediaCodecVideoDecoder$VideoCodecType", codecType_);
363 bool success = jni->CallBooleanMethod( 353 bool success = jni->CallBooleanMethod(
364 *j_media_codec_video_decoder_, 354 *j_media_codec_video_decoder_,
365 j_init_decode_method_, 355 j_init_decode_method_,
366 j_video_codec_enum, 356 j_video_codec_enum,
367 codec_.width, 357 codec_.width,
368 codec_.height, 358 codec_.height,
369 java_surface_texture_helper_); 359 use_surface_ ? surface_texture_helper_->GetJavaSurfaceTextureHelper()
360 : nullptr);
370 361
371 if (CheckException(jni) || !success) { 362 if (CheckException(jni) || !success) {
372 ALOGE << "Codec initialization error - fallback to SW codec."; 363 ALOGE << "Codec initialization error - fallback to SW codec.";
373 sw_fallback_required_ = true; 364 sw_fallback_required_ = true;
374 return WEBRTC_VIDEO_CODEC_ERROR; 365 return WEBRTC_VIDEO_CODEC_ERROR;
375 } 366 }
376 inited_ = true; 367 inited_ = true;
377 368
378 switch (codecType_) { 369 switch (codecType_) {
379 case kVideoCodecVP8: 370 case kVideoCodecVP8:
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 ALOGD << "Destroy video decoder."; 982 ALOGD << "Destroy video decoder.";
992 delete decoder; 983 delete decoder;
993 } 984 }
994 985
995 const char* MediaCodecVideoDecoder::ImplementationName() const { 986 const char* MediaCodecVideoDecoder::ImplementationName() const {
996 return "MediaCodec"; 987 return "MediaCodec";
997 } 988 }
998 989
999 } // namespace webrtc_jni 990 } // namespace webrtc_jni
1000 991
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698