Bug 1477011 - Report vp9 in mp4 as supported. r=dminor
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 20 Jul 2018 11:36:57 +0000
changeset 427462 afcfe1cd7c552fd0fb79405d4755a346358c55e2
parent 427461 54e79326147a7618d4b08f24c74e3c8ef03ba4f3
child 427463 c1a1d1e1cfbf784f26b3ca0e7ca1a4e6e8420459
push id34306
push usercsabou@mozilla.com
push dateFri, 20 Jul 2018 21:41:18 +0000
treeherdermozilla-central@d6a5e8aea651 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdminor
bugs1477011
milestone63.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 1477011 - Report vp9 in mp4 as supported. r=dminor Since we switched to the mp4 rust demuxer, VP9 in mp4 is always supported. Differential Revision: https://phabricator.services.mozilla.com/D2261
dom/html/HTMLMediaElement.cpp
dom/media/test/test_can_play_type_mpeg.html
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4773,45 +4773,27 @@ HTMLMediaElement::UnbindFromTree(bool aD
     NS_NewRunnableFunction("dom::HTMLMediaElement::UnbindFromTree", [self]() {
       if (self->mUnboundFromTree) {
         self->Pause();
       }
     });
   RunInStableState(task);
 }
 
-static bool
-IsVP9InMP4(const MediaContainerType& aContainerType)
-{
-  const MediaContainerType mimeType(aContainerType.Type());
-  return DecoderTraits::IsMP4SupportedType(
-           mimeType,
-           /* DecoderDoctorDiagnostics* */ nullptr) &&
-         IsVP9CodecString(aContainerType.ExtendedType().Codecs().AsString());
-}
-
 /* static */
 CanPlayStatus
 HTMLMediaElement::GetCanPlay(const nsAString& aType,
                              DecoderDoctorDiagnostics* aDiagnostics)
 {
   Maybe<MediaContainerType> containerType = MakeMediaContainerType(aType);
   if (!containerType) {
     return CANPLAY_NO;
   }
   CanPlayStatus status =
     DecoderTraits::CanHandleContainerType(*containerType, aDiagnostics);
-  if (status == CANPLAY_YES && IsVP9InMP4(*containerType)) {
-    // We don't have a demuxer that can handle VP9 in non-fragmented MP4.
-    // So special-case VP9 in MP4 here, as we assume canPlayType() implies
-    // non-fragmented MP4 anyway. Note we report that we can play VP9
-    // in MP4 in MediaSource.isTypeSupported(), as the fragmented MP4
-    // demuxer can handle VP9 in fragmented MP4.
-    return CANPLAY_NO;
-  }
   if (status == CANPLAY_YES &&
       (*containerType).ExtendedType().Codecs().IsEmpty()) {
     // Per spec: 'Generally, a user agent should never return "probably" for a
     // type that allows the `codecs` parameter if that parameter is not
     // present.' As all our currently-supported types allow for `codecs`, we can
     // do this check here.
     // TODO: Instead, missing `codecs` should be checked in each decoder's
     // `IsSupportedType` call from `CanHandleCodecsType()`.
--- a/dom/media/test/test_can_play_type_mpeg.html
+++ b/dom/media/test/test_can_play_type_mpeg.html
@@ -83,31 +83,24 @@ function check_mp4(v, enabled) {
   check("audio/mp4; codecs=\"opus\"", "probably");
   check("audio/mp4; codecs=opus", "probably");
 
   // Flac.
   check("audio/mp4; codecs=\"flac\"", "probably");
   check("audio/mp4; codecs=flac", "probably");
 
   // VP9.
-  // Note: canPlayType assumes non-fragmented MP4. Once we support VP9 in
-  // non-fragmented MP4, we need to change this to report supported.
   [ "video/mp4; codecs=vp9",
     "video/mp4; codecs=\"vp9\"",
     "video/mp4; codecs=\"vp9.0\""
   ].forEach((codec) => {
-    // canPlayType should not support VP9 in MP4...
-    check(codec, "");
-    // But VP9 in MP4 is supported in MSE.
+    // canPlayType should support VP9 in MP4...
+    check(codec, "probably");
     ok(MediaSource.isTypeSupported(codec), "VP9 in MP4 should be supported in MSE");
   });
-
-  check("video/mp4; codecs=vp9", "");
-  check("video/mp4; codecs=\"vp9\"", "");
-  check("video/mp4; codecs=\"vp9.0\"", "");
 }
 
 function check_mp3(v, enabled) {
   function check(type, expected) {
     var ex = enabled ? expected : "";
     is(v.canPlayType(type), ex, type + "='" + ex + "'");
   }