Commit dcbf4028 authored by Mounir Lamouri's avatar Mounir Lamouri Committed by Commit Bot

Autoplay: only disable Web Audio autoplay policy when the document user activation policy applies.

This is affecting WebView that has a different autoplay policy but
also would affect any client using a different policy from the default
one.

Bug: 850445
Change-Id: Ifaac3e15c4644c32e540b20e62bb3ee70d9a0b12
Reviewed-on: https://chromium-review.googlesource.com/1102827Reviewed-by: default avatarBo <boliu@chromium.org>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567753}
parent 80a1b322
...@@ -170,10 +170,6 @@ bool AwMainDelegate::BasicStartupComplete(int* exit_code) { ...@@ -170,10 +170,6 @@ bool AwMainDelegate::BasicStartupComplete(int* exit_code) {
CommandLineHelper::AddDisabledFeature(*cl, CommandLineHelper::AddDisabledFeature(*cl,
media::kMediaDrmPersistentLicense.name); media::kMediaDrmPersistentLicense.name);
// WebView requires audio autoplay to respect the document autoplay behavior.
CommandLineHelper::AddDisabledFeature(*cl,
media::kAutoplayIgnoreWebAudio.name);
CommandLineHelper::AddEnabledFeature( CommandLineHelper::AddEnabledFeature(
*cl, autofill::features::kAutofillSkipComparingInferredLabels.name); *cl, autofill::features::kAutofillSkipComparingInferredLabels.name);
......
...@@ -313,7 +313,15 @@ void AudioContext::NotifySourceNodeStart() { ...@@ -313,7 +313,15 @@ void AudioContext::NotifySourceNodeStart() {
} }
AutoplayPolicy::Type AudioContext::GetAutoplayPolicy() const { AutoplayPolicy::Type AudioContext::GetAutoplayPolicy() const {
if (RuntimeEnabledFeatures::AutoplayIgnoresWebAudioEnabled()) { Document* document = GetDocument();
DCHECK(document);
auto autoplay_policy =
AutoplayPolicy::GetAutoplayPolicyForDocument(*document);
if (autoplay_policy ==
AutoplayPolicy::Type::kDocumentUserActivationRequired &&
RuntimeEnabledFeatures::AutoplayIgnoresWebAudioEnabled()) {
// When ignored, the policy is different on Android compared to Desktop. // When ignored, the policy is different on Android compared to Desktop.
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
return AutoplayPolicy::Type::kUserGestureRequired; return AutoplayPolicy::Type::kUserGestureRequired;
...@@ -323,9 +331,7 @@ AutoplayPolicy::Type AudioContext::GetAutoplayPolicy() const { ...@@ -323,9 +331,7 @@ AutoplayPolicy::Type AudioContext::GetAutoplayPolicy() const {
#endif #endif
} }
Document* document = GetDocument(); return autoplay_policy;
DCHECK(document);
return AutoplayPolicy::GetAutoplayPolicyForDocument(*document);
} }
bool AudioContext::AreAutoplayRequirementsFulfilled() const { bool AudioContext::AreAutoplayRequirementsFulfilled() const {
......
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