Bug 1262659 - Report HTTP Live Streaming playback requests. r=cpearce,bsmedberg

Identify HLS media types (and related m3u playlists) and report
telemetry about how often we fail to play them. This is designed
to measure popularity to inform decisions about support for this
format.

MozReview-Commit-ID: Fp8lNMOJKyA
This commit is contained in:
Ralph Giles 2016-04-11 14:13:43 -07:00
Родитель 3dd4cb9db8
Коммит 00e18217e5
2 изменённых файлов: 40 добавлений и 0 удалений

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

@ -9,6 +9,7 @@
#include "nsCharSeparatedTokenizer.h"
#include "nsMimeTypes.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "OggDecoder.h"
#include "OggReader.h"
@ -172,6 +173,21 @@ DecoderTraits::IsWebMAudioType(const nsACString& aType)
return aType.EqualsASCII("audio/webm");
}
static char const *const gHttpLiveStreamingTypes[] = {
// For m3u8.
// https://tools.ietf.org/html/draft-pantos-http-live-streaming-19#section-10
"application/vnd.apple.mpegurl",
// Some sites serve these as the informal m3u type.
"audio/x-mpegurl",
nullptr
};
static bool
IsHttpLiveStreamingType(const nsACString& aType)
{
return CodecListContains(gHttpLiveStreamingTypes, aType);
}
#ifdef MOZ_OMX_DECODER
static const char* const gOmxTypes[] = {
"audio/mpeg",
@ -477,6 +493,10 @@ DecoderTraits::CanHandleMediaType(const char* aMIMEType,
{
MOZ_ASSERT(NS_IsMainThread());
if (IsHttpLiveStreamingType(nsDependentCString(aMIMEType))) {
Telemetry::Accumulate(Telemetry::MEDIA_HLS_CANPLAY_REQUESTED, true);
}
if (aHaveRequestedCodecs) {
CanPlayStatus result = CanHandleCodecsType(aMIMEType,
aRequestedCodecs,
@ -621,6 +641,11 @@ InstantiateDecoder(const nsACString& aType,
}
#endif
if (IsHttpLiveStreamingType(aType)) {
// We don't have an HLS decoder.
Telemetry::Accumulate(Telemetry::MEDIA_HLS_DECODER_SUCCESS, false);
}
return nullptr;
}

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

@ -6263,6 +6263,21 @@
"description": "Whether Ogg audio/video encountered are chained or not.",
"bug_numbers": [1230295]
},
"MEDIA_HLS_CANPLAY_REQUESTED": {
"alert_emails": ["ajones@mozilla.com", "giles@mozilla.com"],
"expires_in_version": "50",
"kind": "boolean",
"description": "Reports a true value when a page requests canPlayType for an HTTP Live Streaming media type (or generic m3u playlist).",
"bug_numbers": [1262659]
},
"MEDIA_HLS_DECODER_SUCCESS": {
"alert_emails": ["ajones@mozilla.com", "giles@mozilla.com"],
"expires_in_version": "50",
"kind": "boolean",
"description": "Reports whether a decoder for an HTTP Live Streaming media type was created when requested.",
"bug_numbers": [1262659]
},
"VIDEO_MFT_OUTPUT_NULL_SAMPLES": {
"alert_emails": ["cpearce@mozilla.com"],
"expires_in_version": "53",