Commit 2fb1112f authored by Tomasz Śniatowski's avatar Tomasz Śniatowski Committed by Commit Bot

Fix encoder/decoder typo in android media_codec_util.cc

Make MediaCodecUtil::IsHEVCDecoderAvailable call IsDecoderSupportedByDevice
instead of IsEncoderSupportedByDevice. It looks like a typo, and isn't
harmless: it can cause content shell to stall at startup if built with
enable_hevc_demuxing=true when the renderer tries to query the encoder.

Apparently it's a case of doing something in the renderer that's not
allowed, as explained in
https://chromium-review.googlesource.com/c/chromium/src/+/1694241
(which happened to add this encoder/decoder typo).

BUG=980091, 980682
TEST=build with enable_hevc_demuxing=true, run content shell apk
R=chcunningham

Change-Id: Iaadc73e6dd4301b6e300891cbb0baf7afe8f5e63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1730163Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684091}
parent 69ce6105
......@@ -291,15 +291,10 @@ bool MediaCodecUtil::IsAv1DecoderAvailable() {
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
// static
bool MediaCodecUtil::IsHEVCDecoderAvailable() {
return IsMediaCodecAvailable() && IsEncoderSupportedByDevice(kHevcMimeType);
return IsMediaCodecAvailable() && IsDecoderSupportedByDevice(kHevcMimeType);
}
#endif
// static
bool MediaCodecUtil::IsH264EncoderAvailable() {
return IsMediaCodecAvailable() && IsEncoderSupportedByDevice(kAvcMimeType);
}
// static
bool MediaCodecUtil::IsSurfaceViewOutputSupported() {
// Disable SurfaceView output for the Samsung Galaxy S3; it does not work
......@@ -347,6 +342,11 @@ bool MediaCodecUtil::CanDecode(AudioCodec codec) {
return CanDecodeInternal(CodecToAndroidMimeType(codec), false);
}
// static
bool MediaCodecUtil::IsH264EncoderAvailable() {
return IsMediaCodecAvailable() && IsEncoderSupportedByDevice(kAvcMimeType);
}
// static
bool MediaCodecUtil::AddSupportedCodecProfileLevels(
std::vector<CodecProfileLevel>* result) {
......
......@@ -77,9 +77,6 @@ class MEDIA_EXPORT MediaCodecUtil {
static bool IsHEVCDecoderAvailable();
#endif
// Indicates if the h264 encoder is available on this device.
static bool IsH264EncoderAvailable();
// Indicates if SurfaceView and MediaCodec work well together on this device.
static bool IsSurfaceViewOutputSupported();
......@@ -104,6 +101,12 @@ class MEDIA_EXPORT MediaCodecUtil {
static bool CanDecode(VideoCodec codec, bool is_secure);
static bool CanDecode(AudioCodec codec);
// Indicates if the h264 encoder is available on this device.
//
// WARNING: This can't be used from the renderer process since it attempts to
// access MediaCodecList (which requires permissions).
static bool IsH264EncoderAvailable();
// Returns a vector of supported codecs profiles and levels.
//
// WARNING: This can't be used from the renderer process since it attempts to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment