Bug 1715415 - part2 : clear the active session Id when stopping a controller. r=chunmin

As we would not deactivate the controller if we have an active session [1], clear the active session Id in order to trigger the process of deactivating controller later.

[1] https://searchfox.org/mozilla-central/rev/f351e19360729b351bfc7c1386d6e4ca4ea676e2/dom/media/mediacontrol/MediaController.cpp#352-362

Differential Revision: https://phabricator.services.mozilla.com/D117956
This commit is contained in:
alwu 2021-07-08 21:28:48 +00:00
Родитель a6c6a12ec7
Коммит 0f80f824b2
2 изменённых файлов: 3 добавлений и 1 удалений

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

@ -170,6 +170,7 @@ void MediaController::Stop() {
LOG("Stop");
UpdateMediaControlActionToContentMediaIfNeeded(
MediaControlAction(MediaControlKey::Stop));
MediaStatusManager::ClearActiveMediaSessionContextIdIfNeeded();
}
uint64_t MediaController::Id() const { return mTopLevelBrowsingContextId; }

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

@ -212,6 +212,8 @@ class MediaStatusManager : public IMediaInfoUpdater {
// media session and owns the audio focus within a tab.
Maybe<uint64_t> mActiveMediaSessionContextId;
void ClearActiveMediaSessionContextIdIfNeeded();
private:
nsString GetDefaultFaviconURL() const;
nsString GetDefaultTitle() const;
@ -221,7 +223,6 @@ class MediaStatusManager : public IMediaInfoUpdater {
bool IsSessionOwningAudioFocus(uint64_t aBrowsingContextId) const;
void SetActiveMediaSessionContextId(uint64_t aBrowsingContextId);
void ClearActiveMediaSessionContextIdIfNeeded();
void HandleAudioFocusOwnerChanged(Maybe<uint64_t>& aBrowsingContextId);
void NotifySupportedKeysChangedIfNeeded(uint64_t aBrowsingContextId);