summaryrefslogtreecommitdiffstats
path: root/dom/media/mediacontrol/ContentMediaController.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/media/mediacontrol/ContentMediaController.cpp
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/mediacontrol/ContentMediaController.cpp')
-rw-r--r--dom/media/mediacontrol/ContentMediaController.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/dom/media/mediacontrol/ContentMediaController.cpp b/dom/media/mediacontrol/ContentMediaController.cpp
index e1fe574d9b..0c3bbbecdc 100644
--- a/dom/media/mediacontrol/ContentMediaController.cpp
+++ b/dom/media/mediacontrol/ContentMediaController.cpp
@@ -304,6 +304,37 @@ void ContentMediaAgent::UpdatePositionState(
}
}
+void ContentMediaAgent::UpdateGuessedPositionState(
+ uint64_t aBrowsingContextId, const nsID& aMediaId,
+ const Maybe<PositionState>& aState) {
+ RefPtr<BrowsingContext> bc = GetBrowsingContextForAgent(aBrowsingContextId);
+ if (!bc || bc->IsDiscarded()) {
+ return;
+ }
+
+ if (aState) {
+ LOG("Update guessed position state for BC %" PRId64
+ " media id %s (duration=%f, playbackRate=%f, position=%f)",
+ bc->Id(), aMediaId.ToString().get(), aState->mDuration,
+ aState->mPlaybackRate, aState->mLastReportedPlaybackPosition);
+ } else {
+ LOG("Clear guessed position state for BC %" PRId64 " media id %s", bc->Id(),
+ aMediaId.ToString().get());
+ }
+
+ if (XRE_IsContentProcess()) {
+ ContentChild* contentChild = ContentChild::GetSingleton();
+ Unused << contentChild->SendNotifyGuessedPositionStateChanged(bc, aMediaId,
+ aState);
+ return;
+ }
+ // This would only happen when we disable e10s.
+ if (RefPtr<IMediaInfoUpdater> updater =
+ bc->Canonical()->GetMediaController()) {
+ updater->UpdateGuessedPositionState(bc->Id(), aMediaId, aState);
+ }
+}
+
ContentMediaController::ContentMediaController(uint64_t aId) {
LOG("Create content media controller for BC %" PRId64, aId);
}