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() { ...@@ -291,15 +291,10 @@ bool MediaCodecUtil::IsAv1DecoderAvailable() {
#if BUILDFLAG(ENABLE_HEVC_DEMUXING) #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
// static // static
bool MediaCodecUtil::IsHEVCDecoderAvailable() { bool MediaCodecUtil::IsHEVCDecoderAvailable() {
return IsMediaCodecAvailable() && IsEncoderSupportedByDevice(kHevcMimeType); return IsMediaCodecAvailable() && IsDecoderSupportedByDevice(kHevcMimeType);
} }
#endif #endif
// static
bool MediaCodecUtil::IsH264EncoderAvailable() {
return IsMediaCodecAvailable() && IsEncoderSupportedByDevice(kAvcMimeType);
}
// static // static
bool MediaCodecUtil::IsSurfaceViewOutputSupported() { bool MediaCodecUtil::IsSurfaceViewOutputSupported() {
// Disable SurfaceView output for the Samsung Galaxy S3; it does not work // Disable SurfaceView output for the Samsung Galaxy S3; it does not work
...@@ -347,6 +342,11 @@ bool MediaCodecUtil::CanDecode(AudioCodec codec) { ...@@ -347,6 +342,11 @@ bool MediaCodecUtil::CanDecode(AudioCodec codec) {
return CanDecodeInternal(CodecToAndroidMimeType(codec), false); return CanDecodeInternal(CodecToAndroidMimeType(codec), false);
} }
// static
bool MediaCodecUtil::IsH264EncoderAvailable() {
return IsMediaCodecAvailable() && IsEncoderSupportedByDevice(kAvcMimeType);
}
// static // static
bool MediaCodecUtil::AddSupportedCodecProfileLevels( bool MediaCodecUtil::AddSupportedCodecProfileLevels(
std::vector<CodecProfileLevel>* result) { std::vector<CodecProfileLevel>* result) {
......
...@@ -77,9 +77,6 @@ class MEDIA_EXPORT MediaCodecUtil { ...@@ -77,9 +77,6 @@ class MEDIA_EXPORT MediaCodecUtil {
static bool IsHEVCDecoderAvailable(); static bool IsHEVCDecoderAvailable();
#endif #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. // Indicates if SurfaceView and MediaCodec work well together on this device.
static bool IsSurfaceViewOutputSupported(); static bool IsSurfaceViewOutputSupported();
...@@ -104,6 +101,12 @@ class MEDIA_EXPORT MediaCodecUtil { ...@@ -104,6 +101,12 @@ class MEDIA_EXPORT MediaCodecUtil {
static bool CanDecode(VideoCodec codec, bool is_secure); static bool CanDecode(VideoCodec codec, bool is_secure);
static bool CanDecode(AudioCodec codec); 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. // Returns a vector of supported codecs profiles and levels.
// //
// WARNING: This can't be used from the renderer process since it attempts to // 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