Bug 1483703 - part2 : add telemetry for the media which was blocked before loading metadata and ended up being without audio track. r=cpearce,francois

Add two telemetry scarlar,

"MEDIA_BLOCKED_NO_METADATA" records how many media which was blocked because it hadn't loaded metadata yet.
"MEDIA_BLOCKED_NO_METADATA_ENDUP_NO_AUDIO_TRACK" records how many media which was blocked because it hadn't loaded metadata and ended up for being no audio track.

By collecting those data, we can know the proportion of media which should be autoplay but was blocked because of lacking metadata.

Differential Revision: https://phabricator.services.mozilla.com/D3671

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2018-08-22 22:50:54 +00:00
Родитель bb11a649df
Коммит 598c2d9bb1
3 изменённых файлов: 48 добавлений и 2 удалений

Просмотреть файл

@ -1826,6 +1826,7 @@ HTMLMediaElement::AbortExistingLoads()
mPendingEncryptedInitData.Reset();
mWaitingForKey = NOT_WAITING_FOR_KEY;
mSourcePointer = nullptr;
mBlockedAsWithoutMetadata = false;
mTags = nullptr;
mAudioTrackSilenceStartedTime = 0.0;
@ -4038,7 +4039,7 @@ HTMLMediaElement::AudioChannelAgentDelayingPlayback()
}
void
HTMLMediaElement::UpdateHadAudibleAutoplayState() const
HTMLMediaElement::UpdateHadAudibleAutoplayState()
{
// If we're audible, and autoplaying...
if ((Volume() > 0.0 && !Muted()) &&
@ -4047,6 +4048,10 @@ HTMLMediaElement::UpdateHadAudibleAutoplayState() const
if (AutoplayPolicy::WouldBeAllowedToPlayIfAutoplayDisabled(*this)) {
ScalarAdd(Telemetry::ScalarID::MEDIA_AUTOPLAY_WOULD_BE_ALLOWED_COUNT, 1);
} else {
if (mReadyState < HAVE_METADATA) {
mBlockedAsWithoutMetadata = true;
ScalarAdd(Telemetry::ScalarID::MEDIA_BLOCKED_NO_METADATA, 1);
}
if (mReadyState >= HAVE_METADATA && !HasAudio()) {
ScalarAdd(Telemetry::ScalarID::MEDIA_BLOCKED_AUTOPLAY_NO_AUDIO_TRACK_COUNT, 1);
}
@ -5575,6 +5580,12 @@ HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
(Volume() != 0 && !Muted())) {
ScalarAdd(Telemetry::ScalarID::MEDIA_BLOCKED_AUTOPLAY_NO_AUDIO_TRACK_COUNT, 1);
}
if (mBlockedAsWithoutMetadata && !HasAudio()) {
mBlockedAsWithoutMetadata = false;
ScalarAdd(Telemetry::ScalarID::MEDIA_BLOCKED_NO_METADATA_ENDUP_NO_AUDIO_TRACK, 1);
}
if (mDecoder && mDecoder->IsTransportSeekable() &&
mDecoder->IsMediaSeekable()) {
ProcessMediaFragmentURI();

Просмотреть файл

@ -1761,6 +1761,9 @@ protected:
// before attaching to the DOM tree.
bool mUnboundFromTree = false;
// True if the autoplay media was blocked because it hadn't loaded metadata yet.
bool mBlockedAsWithoutMetadata = false;
public:
// Helper class to measure times for MSE telemetry stats
class TimeDurationAccumulator
@ -1814,7 +1817,7 @@ private:
already_AddRefed<PlayPromise> CreatePlayPromise(ErrorResult& aRv) const;
void UpdateHadAudibleAutoplayState() const;
void UpdateHadAudibleAutoplayState();
/**
* This function is called by AfterSetAttr and OnAttrSetButNotChanged.

Просмотреть файл

@ -948,6 +948,38 @@ media:
- main
- content
blocked_no_metadata:
bug_numbers:
- 1483703
description: >
The number of HTMLMediaElements which we blocked because they hadn't loaded metadata yet.
expires: "68"
kind: uint
notification_emails:
- cpearce@mozilla.com
- alwu@mozilla.com
- nohlmeier@mozilla.com
release_channel_collection: opt-in
record_in_processes:
- main
- content
blocked_no_metadata_endup_no_audio_track:
bug_numbers:
- 1483703
description: >
The number of HTMLMediaElements which were blocked because they hadn't loaded metadata yet, but ended up having no audio track.
expires: "68"
kind: uint
notification_emails:
- cpearce@mozilla.com
- alwu@mozilla.com
- nohlmeier@mozilla.com
release_channel_collection: opt-in
record_in_processes:
- main
- content
# The following section contains content process base counters.
dom.contentprocess:
buildID_mismatch: