summaryrefslogtreecommitdiffstats
path: root/dom/media/mediacontrol
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /dom/media/mediacontrol
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/mediacontrol')
-rw-r--r--dom/media/mediacontrol/ContentMediaController.cpp6
-rw-r--r--dom/media/mediacontrol/ContentPlaybackController.cpp4
-rw-r--r--dom/media/mediacontrol/MediaControlKeyManager.cpp2
-rw-r--r--dom/media/mediacontrol/MediaControlUtils.h56
-rw-r--r--dom/media/mediacontrol/MediaStatusManager.cpp10
-rw-r--r--dom/media/mediacontrol/tests/browser/browser.toml1
-rw-r--r--dom/media/mediacontrol/tests/browser/file_error_media.html2
7 files changed, 13 insertions, 68 deletions
diff --git a/dom/media/mediacontrol/ContentMediaController.cpp b/dom/media/mediacontrol/ContentMediaController.cpp
index c0b466ff0f..e1fe574d9b 100644
--- a/dom/media/mediacontrol/ContentMediaController.cpp
+++ b/dom/media/mediacontrol/ContentMediaController.cpp
@@ -229,7 +229,7 @@ void ContentMediaAgent::EnableAction(uint64_t aBrowsingContextId,
}
LOG("Notify to enable action '%s' in BC %" PRId64,
- ToMediaSessionActionStr(aAction), bc->Id());
+ GetEnumString(aAction).get(), bc->Id());
if (XRE_IsContentProcess()) {
ContentChild* contentChild = ContentChild::GetSingleton();
Unused << contentChild->SendNotifyMediaSessionSupportedActionChanged(
@@ -251,7 +251,7 @@ void ContentMediaAgent::DisableAction(uint64_t aBrowsingContextId,
}
LOG("Notify to disable action '%s' in BC %" PRId64,
- ToMediaSessionActionStr(aAction), bc->Id());
+ GetEnumString(aAction).get(), bc->Id());
if (XRE_IsContentProcess()) {
ContentChild* contentChild = ContentChild::GetSingleton();
Unused << contentChild->SendNotifyMediaSessionSupportedActionChanged(
@@ -325,7 +325,7 @@ void ContentMediaController::HandleMediaKey(MediaControlKey aKey) {
if (mReceivers.IsEmpty()) {
return;
}
- LOG("Handle '%s' event, receiver num=%zu", ToMediaControlKeyStr(aKey),
+ LOG("Handle '%s' event, receiver num=%zu", GetEnumString(aKey).get(),
mReceivers.Length());
// We have default handlers for play, pause and stop.
// https://w3c.github.io/mediasession/#ref-for-dom-mediasessionaction-play%E2%91%A3
diff --git a/dom/media/mediacontrol/ContentPlaybackController.cpp b/dom/media/mediacontrol/ContentPlaybackController.cpp
index fcc8e3ab58..ba06ea1cdb 100644
--- a/dom/media/mediacontrol/ContentPlaybackController.cpp
+++ b/dom/media/mediacontrol/ContentPlaybackController.cpp
@@ -46,7 +46,7 @@ void ContentPlaybackController::NotifyContentMediaControlKeyReceiver(
if (RefPtr<ContentMediaControlKeyReceiver> receiver =
ContentMediaControlKeyReceiver::Get(mBC)) {
LOG("Handle '%s' in default behavior for BC %" PRIu64,
- ToMediaControlKeyStr(aKey), mBC->Id());
+ GetEnumString(aKey).get(), mBC->Id());
receiver->HandleMediaKey(aKey);
}
}
@@ -61,7 +61,7 @@ void ContentPlaybackController::NotifyMediaSession(
const MediaSessionActionDetails& aDetails) {
if (RefPtr<MediaSession> session = GetMediaSession()) {
LOG("Handle '%s' in media session behavior for BC %" PRIu64,
- ToMediaSessionActionStr(aDetails.mAction), mBC->Id());
+ GetEnumString(aDetails.mAction).get(), mBC->Id());
MOZ_ASSERT(session->IsActive(), "Notify inactive media session!");
session->NotifyHandler(aDetails);
}
diff --git a/dom/media/mediacontrol/MediaControlKeyManager.cpp b/dom/media/mediacontrol/MediaControlKeyManager.cpp
index ba6ed3a524..b40d3af91e 100644
--- a/dom/media/mediacontrol/MediaControlKeyManager.cpp
+++ b/dom/media/mediacontrol/MediaControlKeyManager.cpp
@@ -161,7 +161,7 @@ void MediaControlKeyManager::SetSupportedMediaKeys(
const MediaKeysArray& aSupportedKeys) {
mSupportedKeys.Clear();
for (const auto& key : aSupportedKeys) {
- LOG_INFO("Supported keys=%s", ToMediaControlKeyStr(key));
+ LOG_INFO("Supported keys=%s", GetEnumString(key).get());
mSupportedKeys.AppendElement(key);
}
if (mEventSource && mEventSource->IsOpened()) {
diff --git a/dom/media/mediacontrol/MediaControlUtils.h b/dom/media/mediacontrol/MediaControlUtils.h
index e4e75e7c97..f013c40aa2 100644
--- a/dom/media/mediacontrol/MediaControlUtils.h
+++ b/dom/media/mediacontrol/MediaControlUtils.h
@@ -20,66 +20,12 @@ extern mozilla::LazyLogModule gMediaControlLog;
namespace mozilla::dom {
-inline const char* ToMediaControlKeyStr(MediaControlKey aKey) {
- switch (aKey) {
- case MediaControlKey::Focus:
- return "Focus";
- case MediaControlKey::Pause:
- return "Pause";
- case MediaControlKey::Play:
- return "Play";
- case MediaControlKey::Playpause:
- return "Play & pause";
- case MediaControlKey::Previoustrack:
- return "Previous track";
- case MediaControlKey::Nexttrack:
- return "Next track";
- case MediaControlKey::Seekbackward:
- return "Seek backward";
- case MediaControlKey::Seekforward:
- return "Seek forward";
- case MediaControlKey::Skipad:
- return "Skip Ad";
- case MediaControlKey::Seekto:
- return "Seek to";
- case MediaControlKey::Stop:
- return "Stop";
- default:
- MOZ_ASSERT_UNREACHABLE("Invalid action.");
- return "Unknown";
- }
-}
-
inline const char* ToMediaControlKeyStr(const Maybe<MediaControlKey>& aKey) {
if (aKey.isNothing()) {
MOZ_ASSERT_UNREACHABLE("Invalid action.");
return "Unknown";
}
- return ToMediaControlKeyStr(aKey.value());
-}
-
-inline const char* ToMediaSessionActionStr(MediaSessionAction aAction) {
- switch (aAction) {
- case MediaSessionAction::Play:
- return "play";
- case MediaSessionAction::Pause:
- return "pause";
- case MediaSessionAction::Seekbackward:
- return "seek backward";
- case MediaSessionAction::Seekforward:
- return "seek forward";
- case MediaSessionAction::Previoustrack:
- return "previous track";
- case MediaSessionAction::Nexttrack:
- return "next track";
- case MediaSessionAction::Skipad:
- return "skip ad";
- case MediaSessionAction::Seekto:
- return "Seek to";
- default:
- MOZ_ASSERT(aAction == MediaSessionAction::Stop);
- return "stop";
- }
+ return GetEnumString(aKey.value()).get();
}
inline MediaControlKey ConvertMediaSessionActionToControlKey(
diff --git a/dom/media/mediacontrol/MediaStatusManager.cpp b/dom/media/mediacontrol/MediaStatusManager.cpp
index 9187e56f25..633ae19a44 100644
--- a/dom/media/mediacontrol/MediaStatusManager.cpp
+++ b/dom/media/mediacontrol/MediaStatusManager.cpp
@@ -338,10 +338,10 @@ void MediaStatusManager::EnableAction(uint64_t aBrowsingContextId,
}
if (info->IsActionSupported(aAction)) {
LOG("Action '%s' has already been enabled for context %" PRIu64,
- ToMediaSessionActionStr(aAction), aBrowsingContextId);
+ GetEnumString(aAction).get(), aBrowsingContextId);
return;
}
- LOG("Enable action %s for context %" PRIu64, ToMediaSessionActionStr(aAction),
+ LOG("Enable action %s for context %" PRIu64, GetEnumString(aAction).get(),
aBrowsingContextId);
info->EnableAction(aAction);
NotifySupportedKeysChangedIfNeeded(aBrowsingContextId);
@@ -355,11 +355,11 @@ void MediaStatusManager::DisableAction(uint64_t aBrowsingContextId,
}
if (!info->IsActionSupported(aAction)) {
LOG("Action '%s' hasn't been enabled yet for context %" PRIu64,
- ToMediaSessionActionStr(aAction), aBrowsingContextId);
+ GetEnumString(aAction).get(), aBrowsingContextId);
return;
}
- LOG("Disable action %s for context %" PRIu64,
- ToMediaSessionActionStr(aAction), aBrowsingContextId);
+ LOG("Disable action %s for context %" PRIu64, GetEnumString(aAction).get(),
+ aBrowsingContextId);
info->DisableAction(aAction);
NotifySupportedKeysChangedIfNeeded(aBrowsingContextId);
}
diff --git a/dom/media/mediacontrol/tests/browser/browser.toml b/dom/media/mediacontrol/tests/browser/browser.toml
index 8b52f2aed4..faeebc0e94 100644
--- a/dom/media/mediacontrol/tests/browser/browser.toml
+++ b/dom/media/mediacontrol/tests/browser/browser.toml
@@ -16,7 +16,6 @@ support-files = [
"file_non_eligible_media.html",
"file_non_looping_media.html",
"head.js",
- "../../../test/bogus.ogv",
"../../../test/gizmo.mp4",
"../../../test/gizmo-noaudio.webm",
"../../../test/gizmo-short.mp4",
diff --git a/dom/media/mediacontrol/tests/browser/file_error_media.html b/dom/media/mediacontrol/tests/browser/file_error_media.html
index 7f54340dd1..dfcdeab65f 100644
--- a/dom/media/mediacontrol/tests/browser/file_error_media.html
+++ b/dom/media/mediacontrol/tests/browser/file_error_media.html
@@ -4,6 +4,6 @@
<title>Error media</title>
</head>
<body>
-<video id="video" src="bogus.ogv"></video>
+<video id="video" src="bogus.webm"></video>
</body>
</html>