diff options
Diffstat (limited to 'dom/media/MediaDecoder.cpp')
-rw-r--r-- | dom/media/MediaDecoder.cpp | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 23c30eed2a..159c6a6121 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -893,9 +893,44 @@ void MediaDecoder::FirstFrameLoaded( // We only care about video first frame. if (mInfo->HasVideo() && mMDSMCreationTime) { - mTelemetryProbesReporter->OntFirstFrameLoaded( - TimeStamp::Now() - *mMDSMCreationTime, IsMSE(), - mDecoderStateMachine->IsExternalEngineStateMachine()); + auto info = MakeUnique<dom::MediaDecoderDebugInfo>(); + RequestDebugInfo(*info)->Then( + GetMainThreadSerialEventTarget(), __func__, + [self = RefPtr<MediaDecoder>{this}, this, now = TimeStamp::Now(), + creationTime = *mMDSMCreationTime, result = std::move(info)]( + GenericPromise::ResolveOrRejectValue&& aValue) mutable { + if (IsShutdown()) { + return; + } + if (aValue.IsReject()) { + NS_WARNING("Failed to get debug info for the first frame probe!"); + return; + } + auto firstFrameLoadedTime = (now - creationTime).ToMilliseconds(); + MOZ_ASSERT(result->mReader.mTotalReadMetadataTimeMs >= 0.0); + MOZ_ASSERT(result->mReader.mTotalWaitingForVideoDataTimeMs >= 0.0); + MOZ_ASSERT(result->mStateMachine.mTotalBufferingTimeMs >= 0.0); + + using FirstFrameLoadedFlag = + TelemetryProbesReporter::FirstFrameLoadedFlag; + TelemetryProbesReporter::FirstFrameLoadedFlagSet flags; + if (IsMSE()) { + flags += FirstFrameLoadedFlag::IsMSE; + } + if (mDecoderStateMachine->IsExternalEngineStateMachine()) { + flags += FirstFrameLoadedFlag::IsExternalEngineStateMachine; + } + if (IsHLSDecoder()) { + flags += FirstFrameLoadedFlag::IsHLS; + } + if (result->mReader.mVideoHardwareAccelerated) { + flags += FirstFrameLoadedFlag::IsHardwareDecoding; + } + mTelemetryProbesReporter->OntFirstFrameLoaded( + firstFrameLoadedTime, result->mReader.mTotalReadMetadataTimeMs, + result->mReader.mTotalWaitingForVideoDataTimeMs, + result->mStateMachine.mTotalBufferingTimeMs, flags, *mInfo); + }); mMDSMCreationTime.reset(); } |