Commit 43ffcb07 authored by Melisa Carranza Z's avatar Melisa Carranza Z Committed by Commit Bot

Add chromecast flag and check for volume control of single volume

platforms.

Bug: b/111922445
Test: Successfully build CastShell.
Change-Id: Iaf61f099001370fb3b948654e126ffa91f6e57d7
Reviewed-on: https://chromium-review.googlesource.com/1186147Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Reviewed-by: default avatarKenneth MacKay <kmackay@chromium.org>
Commit-Queue: Melisa Carranza Zúñiga <melisacz@google.com>
Cr-Commit-Position: refs/heads/master@{#585940}
parent 7b13c53a
...@@ -583,6 +583,7 @@ buildflag_header("chromecast_buildflags") { ...@@ -583,6 +583,7 @@ buildflag_header("chromecast_buildflags") {
"ENABLE_CHROMECAST_EXTENSIONS=$enable_chromecast_extensions", "ENABLE_CHROMECAST_EXTENSIONS=$enable_chromecast_extensions",
"ENABLE_CAST_FRAGMENT=$enable_cast_fragment", "ENABLE_CAST_FRAGMENT=$enable_cast_fragment",
"IS_ANDROID_THINGS_NON_PUBLIC=$is_android_things_non_public", "IS_ANDROID_THINGS_NON_PUBLIC=$is_android_things_non_public",
"IS_SINGLE_VOLUME=$is_single_volume",
"USE_ANDROID_USER_AGENT=$use_android_user_agent", "USE_ANDROID_USER_AGENT=$use_android_user_agent",
"USE_CHROMECAST_CDMS=$use_chromecast_cdms", "USE_CHROMECAST_CDMS=$use_chromecast_cdms",
] ]
......
...@@ -46,6 +46,10 @@ declare_args() { ...@@ -46,6 +46,10 @@ declare_args() {
# Set true for builds targeting Android Things. # Set true for builds targeting Android Things.
is_android_things = false is_android_things = false
# Set true if the platform works as a single volume device, mapping all
# volume streams to a single one.
is_single_volume = false
# Set to true to start music apps in headless mode. # Set to true to start music apps in headless mode.
enable_headless_music_mode = false enable_headless_music_mode = false
......
...@@ -189,12 +189,14 @@ void VolumeControlAndroid::InitializeOnThread() { ...@@ -189,12 +189,14 @@ void VolumeControlAndroid::InitializeOnThread() {
<< " mute=" << muted_[type]; << " mute=" << muted_[type];
} }
#if !BUILDFLAG(IS_SINGLE_VOLUME)
// The kOther content type should not have any type-wide volume control or // The kOther content type should not have any type-wide volume control or
// mute (volume control for kOther is per-stream only). Therefore, ensure // mute (volume control for kOther is per-stream only). Therefore, ensure
// that the global volume and mute state fo kOther is initialized correctly // that the global volume and mute state fo kOther is initialized correctly
// (100% volume, and not muted). // (100% volume, and not muted).
SetVolumeOnThread(AudioContentType::kOther, 1.0f, false /* from_android */); SetVolumeOnThread(AudioContentType::kOther, 1.0f, false /* from_android */);
SetMutedOnThread(AudioContentType::kOther, false, false /* from_android */); SetMutedOnThread(AudioContentType::kOther, false, false /* from_android */);
#endif
initialize_complete_event_.Signal(); initialize_complete_event_.Signal();
} }
...@@ -266,6 +268,7 @@ void VolumeControlAndroid::SetMutedOnThread(AudioContentType type, ...@@ -266,6 +268,7 @@ void VolumeControlAndroid::SetMutedOnThread(AudioContentType type,
void VolumeControlAndroid::ReportVolumeChangeOnThread(AudioContentType type, void VolumeControlAndroid::ReportVolumeChangeOnThread(AudioContentType type,
float level) { float level) {
DCHECK(thread_.task_runner()->BelongsToCurrentThread()); DCHECK(thread_.task_runner()->BelongsToCurrentThread());
#if !BUILDFLAG(IS_SINGLE_VOLUME)
if (type == AudioContentType::kOther) { if (type == AudioContentType::kOther) {
// Volume for AudioContentType::kOther should stay at 1.0. // Volume for AudioContentType::kOther should stay at 1.0.
Java_VolumeControl_setVolume(base::android::AttachCurrentThread(), Java_VolumeControl_setVolume(base::android::AttachCurrentThread(),
...@@ -273,6 +276,7 @@ void VolumeControlAndroid::ReportVolumeChangeOnThread(AudioContentType type, ...@@ -273,6 +276,7 @@ void VolumeControlAndroid::ReportVolumeChangeOnThread(AudioContentType type,
1.0f); 1.0f);
return; return;
} }
#endif
SetVolumeOnThread(type, level, true /* from android */); SetVolumeOnThread(type, level, true /* from android */);
} }
...@@ -280,6 +284,7 @@ void VolumeControlAndroid::ReportVolumeChangeOnThread(AudioContentType type, ...@@ -280,6 +284,7 @@ void VolumeControlAndroid::ReportVolumeChangeOnThread(AudioContentType type,
void VolumeControlAndroid::ReportMuteChangeOnThread(AudioContentType type, void VolumeControlAndroid::ReportMuteChangeOnThread(AudioContentType type,
bool muted) { bool muted) {
DCHECK(thread_.task_runner()->BelongsToCurrentThread()); DCHECK(thread_.task_runner()->BelongsToCurrentThread());
#if !BUILDFLAG(IS_SINGLE_VOLUME)
if (type == AudioContentType::kOther) { if (type == AudioContentType::kOther) {
// Mute state for AudioContentType::kOther should always be false. // Mute state for AudioContentType::kOther should always be false.
Java_VolumeControl_setMuted(base::android::AttachCurrentThread(), Java_VolumeControl_setMuted(base::android::AttachCurrentThread(),
...@@ -287,6 +292,7 @@ void VolumeControlAndroid::ReportMuteChangeOnThread(AudioContentType type, ...@@ -287,6 +292,7 @@ void VolumeControlAndroid::ReportMuteChangeOnThread(AudioContentType type,
false); false);
return; return;
} }
#endif
SetMutedOnThread(type, muted, true /* from_android */); SetMutedOnThread(type, muted, true /* from_android */);
} }
......
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