Commit 798bba05 authored by Yuchen Liu's avatar Yuchen Liu Committed by Commit Bot

[Chromecast] Spatial rendering check

Support spatial rendering check for MediaCapabilities API.

Bug: 139027108
Test: On device
Change-Id: I796ad613b3513db88ee685bdbb0ab911b6c2fd0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024417
Auto-Submit: Yuchen Liu <yucliu@chromium.org>
Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Commit-Queue: Yuchen Liu <yucliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735976}
parent 5f8262ac
......@@ -65,6 +65,14 @@
namespace chromecast {
namespace shell {
namespace {
bool IsSupportedBitstreamAudioCodecHelper(::media::AudioCodec codec, int mask) {
return (codec == ::media::kCodecAC3 && (kBitstreamAudioCodecAc3 & mask)) ||
(codec == ::media::kCodecEAC3 && (kBitstreamAudioCodecEac3 & mask)) ||
(codec == ::media::kCodecMpegHAudio &&
(kBitstreamAudioCodecMpegHAudio & mask));
}
} // namespace
#if defined(OS_ANDROID)
// Audio renderer algorithm maximum capacity.
......@@ -246,10 +254,10 @@ void CastContentRendererClient::AddSupportedKeySystems(
bool CastContentRendererClient::IsSupportedAudioType(
const ::media::AudioType& type) {
#if defined(OS_ANDROID)
if (type.spatial_rendering)
return false;
#if defined(OS_ANDROID)
// No ATV device we know of has (E)AC3 decoder, so it relies on the audio sink
// device.
if (type.codec == ::media::kCodecEAC3) {
......@@ -272,7 +280,7 @@ bool CastContentRendererClient::IsSupportedAudioType(
// If the HDMI sink supports bitstreaming the codec, then the vendor backend
// does not need to support it.
if (IsSupportedBitstreamAudioCodec(type.codec))
if (CheckSupportedBitstreamAudioCodec(type.codec, type.spatial_rendering))
return true;
media::AudioCodec codec = media::ToCastAudioCodec(type.codec);
......@@ -304,15 +312,21 @@ bool CastContentRendererClient::IsSupportedVideoType(
bool CastContentRendererClient::IsSupportedBitstreamAudioCodec(
::media::AudioCodec codec) {
return (codec == ::media::kCodecAC3 &&
(kBitstreamAudioCodecAc3 &
supported_bitstream_audio_codecs_info_.codecs)) ||
(codec == ::media::kCodecEAC3 &&
(kBitstreamAudioCodecEac3 &
supported_bitstream_audio_codecs_info_.codecs)) ||
(codec == ::media::kCodecMpegHAudio &&
(kBitstreamAudioCodecMpegHAudio &
supported_bitstream_audio_codecs_info_.codecs));
return IsSupportedBitstreamAudioCodecHelper(
codec, supported_bitstream_audio_codecs_info_.codecs);
}
bool CastContentRendererClient::CheckSupportedBitstreamAudioCodec(
::media::AudioCodec codec,
bool check_spatial_rendering) {
if (!IsSupportedBitstreamAudioCodec(codec))
return false;
if (!check_spatial_rendering)
return true;
return IsSupportedBitstreamAudioCodecHelper(
codec, supported_bitstream_audio_codecs_info_.spatial_rendering);
}
std::unique_ptr<blink::WebPrescientNetworking>
......
......@@ -90,6 +90,9 @@ class CastContentRendererClient
void OnSupportedBitstreamAudioCodecsChanged(
const BitstreamAudioCodecsInfo& info) override;
bool CheckSupportedBitstreamAudioCodec(::media::AudioCodec codec,
bool check_spatial_rendering);
std::unique_ptr<media::MediaCapsObserverImpl> media_caps_observer_;
std::unique_ptr<media::SupportedCodecProfileLevelsMemo> supported_profiles_;
mojo::Receiver<mojom::ApplicationMediaCapabilitiesObserver>
......
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