Never use surface mode in MediaCodecVideoEncoder if egl_context_ is null.

When using VideoFrames, expect_encode_from_texture is true even for
ByteBuffer frames. This causes the encoder to sometimes initialize
itself in surface mode even when egl_context_ is not available.
This leads to a crash.

Bug: webrtc:8776
Change-Id: I8cac36514725b8f430d7bf456d481a4b0c6fcd42
Reviewed-on: https://webrtc-review.googlesource.com/43861
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21789}
This commit is contained in:
Sami Kalliomäki
2018-01-26 13:58:14 +01:00
committed by Commit Bot
parent af4f1b4127
commit 88a0c4add3

View File

@ -366,7 +366,8 @@ int32_t MediaCodecVideoEncoder::InitEncode(const VideoCodec* codec_settings,
return InitEncodeInternal( return InitEncodeInternal(
init_width, init_height, codec_settings->startBitrate, init_width, init_height, codec_settings->startBitrate,
codec_settings->maxFramerate, codec_settings->expect_encode_from_texture); codec_settings->maxFramerate,
codec_settings->expect_encode_from_texture && (egl_context_ != nullptr));
} }
int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */, int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */,