Bug 1702033 - Remove some dead audio volume-related code in nsPIDOMWindow. r=alwu

Differential Revision: https://phabricator.services.mozilla.com/D110296
This commit is contained in:
Emilio Cobos Álvarez 2021-03-30 19:38:02 +00:00
Родитель 83883440fc
Коммит 266a613a4a
3 изменённых файлов: 3 добавлений и 26 удалений

Просмотреть файл

@ -266,7 +266,6 @@ AudioPlaybackConfig AudioChannelService::GetMediaConfig(
config.mCapturedAudio = winData->mIsAudioCaptured;
}
config.mVolume *= window->GetAudioVolume();
config.mMuted = config.mMuted || window->GetAudioMuted();
if (window->GetMediaSuspend() != nsISuspendedTypes::NONE_SUSPENDED) {
config.mSuspend = window->GetMediaSuspend();

Просмотреть файл

@ -3067,29 +3067,14 @@ void nsPIDOMWindowOuter::MaybeNotifyMediaResumedFromBlock(
bool nsPIDOMWindowOuter::GetAudioMuted() const {
BrowsingContext* bc = GetBrowsingContext();
return bc ? bc->Top()->GetMuted() : false;
}
float nsPIDOMWindowOuter::GetAudioVolume() const { return mAudioVolume; }
nsresult nsPIDOMWindowOuter::SetAudioVolume(float aVolume) {
if (aVolume < 0.0) {
return NS_ERROR_DOM_INDEX_SIZE_ERR;
}
if (mAudioVolume == aVolume) {
return NS_OK;
}
mAudioVolume = aVolume;
RefreshMediaElementsVolume();
return NS_OK;
return bc && bc->Top()->GetMuted();
}
void nsPIDOMWindowOuter::RefreshMediaElementsVolume() {
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
if (service) {
service->RefreshAgentsVolume(this, GetAudioVolume(), GetAudioMuted());
// TODO: RefreshAgentsVolume can probably be simplified further.
service->RefreshAgentsVolume(this, 1.0f, GetAudioMuted());
}
}
@ -7659,7 +7644,6 @@ nsPIDOMWindowOuter::nsPIDOMWindowOuter(uint64_t aWindowID)
mMediaSuspend(StaticPrefs::media_block_autoplay_until_in_foreground()
? nsISuspendedTypes::SUSPENDED_BLOCK
: nsISuspendedTypes::NONE_SUSPENDED),
mAudioVolume(1.0),
mDesktopModeViewport(false),
mIsRootOuterWindow(false),
mInnerWindow(nullptr),

Просмотреть файл

@ -780,9 +780,6 @@ class nsPIDOMWindowOuter : public mozIDOMWindowProxy {
bool GetAudioMuted() const;
float GetAudioVolume() const;
nsresult SetAudioVolume(float aVolume);
void MaybeActiveMediaComponents();
void RefreshMediaElementsVolume();
@ -1137,9 +1134,6 @@ class nsPIDOMWindowOuter : public mozIDOMWindowProxy {
*/
SuspendTypes mMediaSuspend;
bool mAudioMuted;
float mAudioVolume;
// current desktop mode flag.
bool mDesktopModeViewport;