Bug 1429986 - send telemetry data when users attempt to play mkv file. r=jwwang,liuche
authorAlfredo.Yang <ayang@mozilla.com>
Fri, 12 Jan 2018 15:40:52 +0800
changeset 399750 4c6d55c85948994725e9335f6867a8ad2bfaa81c
parent 399749 6bb1a5b5510be53b0dcabc836b6bb3d03c3b0846
child 399751 881f72630743689008bc0662a69a960ba630fce9
push id33274
push userdluca@mozilla.com
push dateThu, 18 Jan 2018 09:41:57 +0000
treeherdermozilla-central@a9f3d83fec60 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang, liuche
bugs1429986
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1429986 - send telemetry data when users attempt to play mkv file. r=jwwang,liuche MozReview-Commit-ID: Ah3pXC4cJ7n
dom/media/DecoderTraits.cpp
dom/media/DecoderTraits.h
toolkit/components/telemetry/Histograms.json
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -52,16 +52,25 @@ DecoderTraits::IsHttpLiveStreamingType(c
     mimeType == MEDIAMIMETYPE("application/vnd.apple.mpegurl") ||
     // Some sites serve these as the informal m3u type.
     mimeType == MEDIAMIMETYPE("application/x-mpegurl") ||
     mimeType == MEDIAMIMETYPE("audio/mpegurl") ||
     mimeType == MEDIAMIMETYPE("audio/x-mpegurl");
 }
 
 /* static */ bool
+DecoderTraits::IsMatroskaType(const MediaContainerType& aType)
+{
+  const auto& mimeType = aType.Type();
+  // https://matroska.org/technical/specs/notes.html
+  return mimeType == MEDIAMIMETYPE("audio/x-matroska") ||
+         mimeType == MEDIAMIMETYPE("video/x-matroska");
+}
+
+/* static */ bool
 DecoderTraits::IsMP4SupportedType(const MediaContainerType& aType,
                                   DecoderDoctorDiagnostics* aDiagnostics)
 {
 #ifdef MOZ_FMP4
   return MP4Decoder::IsSupportedType(aType, aDiagnostics);
 #else
   return false;
 #endif
@@ -136,16 +145,18 @@ CanHandleMediaType(const MediaContainerT
 #ifdef MOZ_ANDROID_HLS_SUPPORT
   if (HLSDecoder::IsSupportedType(aType)) {
     return CANPLAY_MAYBE;
   }
 #endif
 
   if (DecoderTraits::IsHttpLiveStreamingType(aType)) {
     Telemetry::Accumulate(Telemetry::MEDIA_HLS_CANPLAY_REQUESTED, true);
+  } else if (DecoderTraits::IsMatroskaType(aType)) {
+    Telemetry::Accumulate(Telemetry::MEDIA_MKV_CANPLAY_REQUESTED, true);
   }
 
   if (aType.ExtendedType().HaveCodecs()) {
     CanPlayStatus result = CanHandleCodecsType(aType, aDiagnostics);
     if (result == CANPLAY_NO || result == CANPLAY_YES) {
       return result;
     }
   }
--- a/dom/media/DecoderTraits.h
+++ b/dom/media/DecoderTraits.h
@@ -48,15 +48,18 @@ public:
   // Convenience function that returns false if MOZ_FMP4 is not defined,
   // otherwise defers to MP4Decoder::IsSupportedType().
   static bool IsMP4SupportedType(const MediaContainerType& aType,
                                  DecoderDoctorDiagnostics* aDiagnostics);
 
   // Returns true if aType is MIME type of hls.
   static bool IsHttpLiveStreamingType(const MediaContainerType& aType);
 
+  // Returns true if aType is matroska type.
+  static bool IsMatroskaType(const MediaContainerType& aType);
+
   static bool IsSupportedType(const MediaContainerType& aType);
 };
 
 } // namespace mozilla
 
 #endif
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8594,16 +8594,24 @@
   "MEDIA_EME_SECURE_CONTEXT": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["cpearce@mozilla.com", "jacheng@mozilla.com"],
     "expires_in_version": "63",
     "kind": "boolean",
     "description": "Reports whether a navigator.requestMediaKeySystemAccess() was called in a secure context (i.e. on an origin served over HTTPS) or not.",
     "bug_numbers": [1360438]
   },
+  "MEDIA_MKV_CANPLAY_REQUESTED": {
+    "record_in_processes": ["main", "content"],
+    "alert_emails": ["ayang@mozilla.com"],
+    "expires_in_version": "65",
+    "kind": "boolean",
+    "description": "Reports a true value when a page requests canPlayType for a matroska media type.",
+    "bug_numbers": [1429986]
+  },
   "MEDIA_EME_REQUEST_DEPRECATED_WARNINGS": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["cpearce@mozilla.com", "jacheng@mozilla.com"],
     "bug_numbers": [1368596],
     "expires_in_version": "63",
     "kind": "enumerated",
     "n_values": 10,
     "description": "Counts types of deprecation warnings logged on every successful call to navigator.requestMediaKeySystemAccess(). 0=No warnings logged, 1=MediaEMENoCapabilitiesDeprecatedWarning, 2=MediaEMENoCodecsDeprecatedWarning."