From 5821999965b3e2b6982da8eddced6db17f5fbfdb Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 7 Apr 2022 17:42:10 +0000 Subject: [PATCH] Bug 1763640 - Add StartBuffering marker. r=alwu This includes a reason for starting to buffer. Differential Revision: https://phabricator.services.mozilla.com/D143187 --- dom/media/MediaDecoderStateMachine.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index 8e9c4025bfec..b955cc237a6f 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -17,6 +17,7 @@ #include "mozilla/NotNull.h" #include "mozilla/Preferences.h" #include "mozilla/ProfilerLabels.h" +#include "mozilla/ProfilerMarkers.h" #include "mozilla/ProfilerMarkerTypes.h" #include "mozilla/SharedThreadPool.h" #include "mozilla/Sprintf.h" @@ -2526,14 +2527,23 @@ void MediaDecoderStateMachine::DecodingState::MaybeStartBuffering() { } // Note we could have a wait promise pending when playing non-MSE EME. - if ((mMaster->OutOfDecodedAudio() && mMaster->IsWaitingAudioData()) || - (mMaster->OutOfDecodedVideo() && mMaster->IsWaitingVideoData())) { + if (mMaster->OutOfDecodedAudio() && mMaster->IsWaitingAudioData()) { + PROFILER_MARKER_TEXT("MDSM::StartBuffering", MEDIA_PLAYBACK, {}, + "OutOfDecodedAudio"); + SetState(); + return; + } + if (mMaster->OutOfDecodedVideo() && mMaster->IsWaitingVideoData()) { + PROFILER_MARKER_TEXT("MDSM::StartBuffering", MEDIA_PLAYBACK, {}, + "OutOfDecodedVideo"); SetState(); return; } if (Reader()->UseBufferingHeuristics() && mMaster->HasLowDecodedData() && mMaster->HasLowBufferedData() && !mMaster->mCanPlayThrough) { + PROFILER_MARKER_TEXT("MDSM::StartBuffering", MEDIA_PLAYBACK, {}, + "BufferingHeuristics"); SetState(); } }