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 @@ ...@@ -65,6 +65,14 @@
namespace chromecast { namespace chromecast {
namespace shell { 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) #if defined(OS_ANDROID)
// Audio renderer algorithm maximum capacity. // Audio renderer algorithm maximum capacity.
...@@ -246,10 +254,10 @@ void CastContentRendererClient::AddSupportedKeySystems( ...@@ -246,10 +254,10 @@ void CastContentRendererClient::AddSupportedKeySystems(
bool CastContentRendererClient::IsSupportedAudioType( bool CastContentRendererClient::IsSupportedAudioType(
const ::media::AudioType& type) { const ::media::AudioType& type) {
#if defined(OS_ANDROID)
if (type.spatial_rendering) if (type.spatial_rendering)
return false; return false;
#if defined(OS_ANDROID)
// No ATV device we know of has (E)AC3 decoder, so it relies on the audio sink // No ATV device we know of has (E)AC3 decoder, so it relies on the audio sink
// device. // device.
if (type.codec == ::media::kCodecEAC3) { if (type.codec == ::media::kCodecEAC3) {
...@@ -272,7 +280,7 @@ bool CastContentRendererClient::IsSupportedAudioType( ...@@ -272,7 +280,7 @@ bool CastContentRendererClient::IsSupportedAudioType(
// If the HDMI sink supports bitstreaming the codec, then the vendor backend // If the HDMI sink supports bitstreaming the codec, then the vendor backend
// does not need to support it. // does not need to support it.
if (IsSupportedBitstreamAudioCodec(type.codec)) if (CheckSupportedBitstreamAudioCodec(type.codec, type.spatial_rendering))
return true; return true;
media::AudioCodec codec = media::ToCastAudioCodec(type.codec); media::AudioCodec codec = media::ToCastAudioCodec(type.codec);
...@@ -304,15 +312,21 @@ bool CastContentRendererClient::IsSupportedVideoType( ...@@ -304,15 +312,21 @@ bool CastContentRendererClient::IsSupportedVideoType(
bool CastContentRendererClient::IsSupportedBitstreamAudioCodec( bool CastContentRendererClient::IsSupportedBitstreamAudioCodec(
::media::AudioCodec codec) { ::media::AudioCodec codec) {
return (codec == ::media::kCodecAC3 && return IsSupportedBitstreamAudioCodecHelper(
(kBitstreamAudioCodecAc3 & codec, supported_bitstream_audio_codecs_info_.codecs);
supported_bitstream_audio_codecs_info_.codecs)) || }
(codec == ::media::kCodecEAC3 &&
(kBitstreamAudioCodecEac3 & bool CastContentRendererClient::CheckSupportedBitstreamAudioCodec(
supported_bitstream_audio_codecs_info_.codecs)) || ::media::AudioCodec codec,
(codec == ::media::kCodecMpegHAudio && bool check_spatial_rendering) {
(kBitstreamAudioCodecMpegHAudio & if (!IsSupportedBitstreamAudioCodec(codec))
supported_bitstream_audio_codecs_info_.codecs)); return false;
if (!check_spatial_rendering)
return true;
return IsSupportedBitstreamAudioCodecHelper(
codec, supported_bitstream_audio_codecs_info_.spatial_rendering);
} }
std::unique_ptr<blink::WebPrescientNetworking> std::unique_ptr<blink::WebPrescientNetworking>
......
...@@ -90,6 +90,9 @@ class CastContentRendererClient ...@@ -90,6 +90,9 @@ class CastContentRendererClient
void OnSupportedBitstreamAudioCodecsChanged( void OnSupportedBitstreamAudioCodecsChanged(
const BitstreamAudioCodecsInfo& info) override; 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::MediaCapsObserverImpl> media_caps_observer_;
std::unique_ptr<media::SupportedCodecProfileLevelsMemo> supported_profiles_; std::unique_ptr<media::SupportedCodecProfileLevelsMemo> supported_profiles_;
mojo::Receiver<mojom::ApplicationMediaCapabilitiesObserver> 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