From c6826b9fadb30cb6733e6c9b7f9a00cc9fd996b9 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Tue, 12 Oct 2021 09:03:57 +0000 Subject: [PATCH] Bug 1678373 - Remove mAudibleState. r=alwu Differential Revision: https://phabricator.services.mozilla.com/D127559 --- dom/media/utils/TelemetryProbesReporter.cpp | 10 ++++------ dom/media/utils/TelemetryProbesReporter.h | 2 -- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/dom/media/utils/TelemetryProbesReporter.cpp b/dom/media/utils/TelemetryProbesReporter.cpp index 2a1598e38d89..3c7de0460d1d 100644 --- a/dom/media/utils/TelemetryProbesReporter.cpp +++ b/dom/media/utils/TelemetryProbesReporter.cpp @@ -159,20 +159,18 @@ void TelemetryProbesReporter::OnVisibilityChanged(Visibility aVisibility) { void TelemetryProbesReporter::OnAudibleChanged(AudibleState aAudibleState) { AssertOnMainThreadAndNotShutdown(); - LOG("Audibility changed: %s -> %s", ToAudibilityStr(mAudibleState), - ToAudibilityStr(aAudibleState)); + LOG("Audibility changed, now %s", ToAudibilityStr(aAudibleState)); if (aAudibleState == AudibleState::eNotAudible) { - MOZ_ASSERT(mAudibleState == AudibleState::eAudible); - StartInaudibleAudioTimeAccumulator(); + if (!mInaudibleAudioPlayTime.IsStarted()) { + StartInaudibleAudioTimeAccumulator(); + } } else { - MOZ_ASSERT(mAudibleState == AudibleState::eNotAudible); // This happens when starting playback, no need to pause, because it hasn't // been started yet. if (mInaudibleAudioPlayTime.IsStarted()) { PauseInaudibleAudioTimeAccumulator(); } } - mAudibleState = aAudibleState; } void TelemetryProbesReporter::OnMutedChanged(bool aMuted) { diff --git a/dom/media/utils/TelemetryProbesReporter.h b/dom/media/utils/TelemetryProbesReporter.h index 726a3a8ae24e..82140f599fcb 100644 --- a/dom/media/utils/TelemetryProbesReporter.h +++ b/dom/media/utils/TelemetryProbesReporter.h @@ -154,8 +154,6 @@ class TelemetryProbesReporter final { Visibility mMediaElementVisibility = Visibility::eInitial; - AudibleState mAudibleState = AudibleState::eNotAudible; - MediaContent mMediaContent = MediaContent::MEDIA_HAS_NOTHING; bool mIsPlaying = false;