Android: Handle SurfaceTextureHelper ctor failure for decoder and capturer

BUG=webrtc:5874
TEST=Manually throw an exception inside the SurfaceTextureHelper ctor and run AppRTCDemo.

Review-Url: https://codereview.webrtc.org/1840193007
Cr-Commit-Position: refs/heads/master@{#12665}
This commit is contained in:
magjed
2016-05-09 08:28:45 -07:00
committed by Commit bot
parent d040480f69
commit 2aa84260d8
6 changed files with 77 additions and 41 deletions

View File

@ -345,8 +345,13 @@ int32_t MediaCodecVideoDecoder::InitDecodeOnCodecThread() {
ResetVariables();
if (use_surface_) {
surface_texture_helper_ = new rtc::RefCountedObject<SurfaceTextureHelper>(
surface_texture_helper_ = SurfaceTextureHelper::create(
jni, "Decoder SurfaceTextureHelper", render_egl_context_);
if (!surface_texture_helper_) {
ALOGE << "Couldn't create SurfaceTextureHelper - fallback to SW codec";
sw_fallback_required_ = true;
return WEBRTC_VIDEO_CODEC_ERROR;
}
}
jobject j_video_codec_enum = JavaEnumFromIndexAndClassName(