Bug 1293145 - Simulate video-decode-suspend for telemetry purposes - r=kamidphish
After a video has been playing while hidden for a certain time, count the time until it is not hidden anymore (or it has finished playing), to test-drive how much decoding time would have been saved by the video-decode-suspend feature. Note that this is done inside HTMLMediaElement by simulating what should happen in the MDSM, because instrumenting the MDSM itself and friends would have been harder and more intrusive. MozReview-Commit-ID: LdxhPtmoXeA
This commit is contained in:
@@ -1125,6 +1125,23 @@ protected:
|
||||
return isPaused;
|
||||
}
|
||||
|
||||
/**
|
||||
* Video has been playing while hidden and, if feature was enabled, would
|
||||
* trigger suspending decoder.
|
||||
* Used to track hidden-video-decode-suspend telemetry.
|
||||
*/
|
||||
static void VideoDecodeSuspendTimerCallback(nsITimer* aTimer, void* aClosure);
|
||||
/**
|
||||
* Video is now both: playing and hidden.
|
||||
* Used to track hidden-video telemetry.
|
||||
*/
|
||||
void HiddenVideoStart();
|
||||
/**
|
||||
* Video is not playing anymore and/or has become visible.
|
||||
* Used to track hidden-video telemetry.
|
||||
*/
|
||||
void HiddenVideoStop();
|
||||
|
||||
#ifdef MOZ_EME
|
||||
void ReportEMETelemetry();
|
||||
#endif
|
||||
@@ -1375,9 +1392,12 @@ protected:
|
||||
// Range of time played.
|
||||
RefPtr<TimeRanges> mPlayed;
|
||||
|
||||
// Timer used for updating progress events
|
||||
// Timer used for updating progress events.
|
||||
nsCOMPtr<nsITimer> mProgressTimer;
|
||||
|
||||
// Timer used to simulate video-suspend.
|
||||
nsCOMPtr<nsITimer> mVideoDecodeSuspendTimer;
|
||||
|
||||
#ifdef MOZ_EME
|
||||
// Encrypted Media Extension media keys.
|
||||
RefPtr<MediaKeys> mMediaKeys;
|
||||
@@ -1636,6 +1656,9 @@ private:
|
||||
// Total time a video has spent playing while hidden.
|
||||
TimeDurationAccumulator mHiddenPlayTime;
|
||||
|
||||
// Total time a video has (or would have) spent in video-decode-suspend mode.
|
||||
TimeDurationAccumulator mVideoDecodeSuspendTime;
|
||||
|
||||
// Indicates if user has interacted with the element.
|
||||
// Used to block autoplay when disabled.
|
||||
bool mHasUserInteraction;
|
||||
|
||||
Reference in New Issue
Block a user