summaryrefslogtreecommitdiffstats
path: root/dom/media/utils
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /dom/media/utils
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/utils')
-rw-r--r--dom/media/utils/TelemetryProbesReporter.cpp46
-rw-r--r--dom/media/utils/TelemetryProbesReporter.h2
2 files changed, 48 insertions, 0 deletions
diff --git a/dom/media/utils/TelemetryProbesReporter.cpp b/dom/media/utils/TelemetryProbesReporter.cpp
index a2854812ba..8c5614c048 100644
--- a/dom/media/utils/TelemetryProbesReporter.cpp
+++ b/dom/media/utils/TelemetryProbesReporter.cpp
@@ -292,6 +292,52 @@ void TelemetryProbesReporter::OnDecodeResumed() {
mOwner->DispatchAsyncTestingEvent(u"mozvideodecodesuspendedpaused"_ns);
}
+void TelemetryProbesReporter::OntFirstFrameLoaded(
+ const TimeDuration& aLoadedFirstFrameTime, bool aIsMSE,
+ bool aIsExternalEngineStateMachine) {
+ const MediaInfo& info = mOwner->GetMediaInfo();
+ MOZ_ASSERT(info.HasVideo());
+ nsCString resolution;
+ DetermineResolutionForTelemetry(info, resolution);
+
+ glean::media_playback::FirstFrameLoadedExtra extraData;
+ extraData.firstFrameLoadedTime = Some(aLoadedFirstFrameTime.ToMilliseconds());
+ if (!aIsMSE && !aIsExternalEngineStateMachine) {
+ extraData.playbackType = Some("Non-MSE playback"_ns);
+ } else if (aIsMSE && !aIsExternalEngineStateMachine) {
+ extraData.playbackType = !mOwner->IsEncrypted() ? Some("MSE playback"_ns)
+ : Some("EME playback"_ns);
+ } else if (!aIsMSE && aIsExternalEngineStateMachine) {
+ extraData.playbackType = Some("Non-MSE media-engine playback"_ns);
+ } else if (aIsMSE && aIsExternalEngineStateMachine) {
+ extraData.playbackType = !mOwner->IsEncrypted()
+ ? Some("MSE media-engine playback"_ns)
+ : Some("EME media-engine playback"_ns);
+ } else {
+ extraData.playbackType = Some("ERROR TYPE"_ns);
+ MOZ_ASSERT(false, "Unexpected playback type!");
+ }
+ extraData.videoCodec = Some(info.mVideo.mMimeType);
+ extraData.resolution = Some(resolution);
+ if (const auto keySystem = mOwner->GetKeySystem()) {
+ extraData.keySystem = Some(NS_ConvertUTF16toUTF8(*keySystem));
+ }
+
+ if (MOZ_LOG_TEST(gTelemetryProbesReporterLog, LogLevel::Debug)) {
+ nsPrintfCString logMessage{
+ "Media_Playabck First_Frame_Loaded event, time(ms)=%f, "
+ "playback-type=%s, videoCodec=%s, resolution=%s",
+ aLoadedFirstFrameTime.ToMilliseconds(), extraData.playbackType->get(),
+ extraData.videoCodec->get(), extraData.resolution->get()};
+ if (const auto keySystem = mOwner->GetKeySystem()) {
+ logMessage.Append(nsPrintfCString{
+ ", keySystem=%s", NS_ConvertUTF16toUTF8(*keySystem).get()});
+ }
+ LOG("%s", logMessage.get());
+ }
+ glean::media_playback::first_frame_loaded.Record(Some(extraData));
+}
+
void TelemetryProbesReporter::OnShutdown() {
AssertOnMainThreadAndNotShutdown();
LOG("Shutdown");
diff --git a/dom/media/utils/TelemetryProbesReporter.h b/dom/media/utils/TelemetryProbesReporter.h
index 51ae2f12bb..be81e8022c 100644
--- a/dom/media/utils/TelemetryProbesReporter.h
+++ b/dom/media/utils/TelemetryProbesReporter.h
@@ -66,6 +66,8 @@ class TelemetryProbesReporter final {
void OnMutedChanged(bool aMuted);
void OnDecodeSuspended();
void OnDecodeResumed();
+ void OntFirstFrameLoaded(const TimeDuration& aLoadedFirstFrameTime,
+ bool aIsMSE, bool aIsExternalEngineStateMachine);
double GetTotalVideoPlayTimeInSeconds() const;
double GetTotalVideoHDRPlayTimeInSeconds() const;