From 8cca05df61ff74b83046dfa2bc1299acc842457e Mon Sep 17 00:00:00 2001 From: Bo-Rong Chen Date: Mon, 7 Oct 2024 11:12:21 -0700 Subject: [PATCH] [android] Fix software video decoder fallback This is the same PR as https://github.com/youtube/cobalt/pull/4111. Original commit message: [PR 3103](https://github.com/youtube/cobalt/pull/3103) fixed MIME attribute "framerate" that enforces a low resolution and low fps playback to use software video decoder. However, If software video decoder is not available, Cobalt should fallback to hardware video decoder. b/328537630 --- starboard/android/shared/media_codec_bridge.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/starboard/android/shared/media_codec_bridge.cc b/starboard/android/shared/media_codec_bridge.cc index 12f1ecc315f2..483d824f800d 100644 --- a/starboard/android/shared/media_codec_bridge.cc +++ b/starboard/android/shared/media_codec_bridge.cc @@ -279,6 +279,16 @@ std::unique_ptr MediaCodecBridge::CreateVideoMediaCodecBridge( /* bitrate = */ 0, /* fps = */ 0); } + if (decoder_name.empty() && require_software_codec) { + // On third pass, forget software codec required. + decoder_name = MediaCapabilitiesCache::GetInstance()->FindVideoDecoder( + mime, must_support_secure, /* must_support_hdr = */ false, + /* require_software_codec = */ false, must_support_tunnel_mode, + /* frame_width = */ 0, + /* frame_height = */ 0, + /* bitrate = */ 0, + /* fps = */ 0); + } if (decoder_name.empty()) { *error_message =