зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
83883440fc
Коммит
266a613a4a
|
@ -266,7 +266,6 @@ AudioPlaybackConfig AudioChannelService::GetMediaConfig(
|
||||||
config.mCapturedAudio = winData->mIsAudioCaptured;
|
config.mCapturedAudio = winData->mIsAudioCaptured;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.mVolume *= window->GetAudioVolume();
|
|
||||||
config.mMuted = config.mMuted || window->GetAudioMuted();
|
config.mMuted = config.mMuted || window->GetAudioMuted();
|
||||||
if (window->GetMediaSuspend() != nsISuspendedTypes::NONE_SUSPENDED) {
|
if (window->GetMediaSuspend() != nsISuspendedTypes::NONE_SUSPENDED) {
|
||||||
config.mSuspend = window->GetMediaSuspend();
|
config.mSuspend = window->GetMediaSuspend();
|
||||||
|
|
|
@ -3067,29 +3067,14 @@ void nsPIDOMWindowOuter::MaybeNotifyMediaResumedFromBlock(
|
||||||
|
|
||||||
bool nsPIDOMWindowOuter::GetAudioMuted() const {
|
bool nsPIDOMWindowOuter::GetAudioMuted() const {
|
||||||
BrowsingContext* bc = GetBrowsingContext();
|
BrowsingContext* bc = GetBrowsingContext();
|
||||||
return bc ? bc->Top()->GetMuted() : false;
|
return bc && bc->Top()->GetMuted();
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsPIDOMWindowOuter::RefreshMediaElementsVolume() {
|
void nsPIDOMWindowOuter::RefreshMediaElementsVolume() {
|
||||||
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
RefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||||
if (service) {
|
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()
|
mMediaSuspend(StaticPrefs::media_block_autoplay_until_in_foreground()
|
||||||
? nsISuspendedTypes::SUSPENDED_BLOCK
|
? nsISuspendedTypes::SUSPENDED_BLOCK
|
||||||
: nsISuspendedTypes::NONE_SUSPENDED),
|
: nsISuspendedTypes::NONE_SUSPENDED),
|
||||||
mAudioVolume(1.0),
|
|
||||||
mDesktopModeViewport(false),
|
mDesktopModeViewport(false),
|
||||||
mIsRootOuterWindow(false),
|
mIsRootOuterWindow(false),
|
||||||
mInnerWindow(nullptr),
|
mInnerWindow(nullptr),
|
||||||
|
|
|
@ -780,9 +780,6 @@ class nsPIDOMWindowOuter : public mozIDOMWindowProxy {
|
||||||
|
|
||||||
bool GetAudioMuted() const;
|
bool GetAudioMuted() const;
|
||||||
|
|
||||||
float GetAudioVolume() const;
|
|
||||||
nsresult SetAudioVolume(float aVolume);
|
|
||||||
|
|
||||||
void MaybeActiveMediaComponents();
|
void MaybeActiveMediaComponents();
|
||||||
|
|
||||||
void RefreshMediaElementsVolume();
|
void RefreshMediaElementsVolume();
|
||||||
|
@ -1137,9 +1134,6 @@ class nsPIDOMWindowOuter : public mozIDOMWindowProxy {
|
||||||
*/
|
*/
|
||||||
SuspendTypes mMediaSuspend;
|
SuspendTypes mMediaSuspend;
|
||||||
|
|
||||||
bool mAudioMuted;
|
|
||||||
float mAudioVolume;
|
|
||||||
|
|
||||||
// current desktop mode flag.
|
// current desktop mode flag.
|
||||||
bool mDesktopModeViewport;
|
bool mDesktopModeViewport;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче