Bug 1176218 - Use DecoderTraits::CanHandleContentType in HTMLMediaElement - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Mon, 26 Sep 2016 13:31:57 +1000
changeset 419877 3a66784408103959e8334f0d9352cf68970a4407
parent 419876 05376179fb11153ded48fb406fd579b670c5608b
child 419878 64a0c9da10815b4c274e15e2f11588c5c27a8a8a
push id31034
push usergsquelart@mozilla.com
push dateSat, 01 Oct 2016 12:07:57 +0000
reviewersjya
bugs1176218
milestone52.0a1
Bug 1176218 - Use DecoderTraits::CanHandleContentType in HTMLMediaElement - r?jya MozReview-Commit-ID: IQFvgI6h1tE
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -103,17 +103,16 @@ static mozilla::LazyLogModule gMediaElem
 #define LOG_EVENT(type, msg) MOZ_LOG(gMediaElementEventsLog, type, msg)
 
 #include "nsIContentSecurityPolicy.h"
 
 #include "mozilla/Preferences.h"
 #include "mozilla/FloatingPoint.h"
 
 #include "nsIPermissionManager.h"
-#include "nsContentTypeParser.h"
 #include "nsDocShell.h"
 
 #include "mozilla/EventStateManager.h"
 
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "mozilla/dom/VideoPlaybackQuality.h"
 
 using namespace mozilla::layers;
@@ -3664,30 +3663,17 @@ void HTMLMediaElement::UnbindFromTree(bo
   }
 }
 
 /* static */
 CanPlayStatus
 HTMLMediaElement::GetCanPlay(const nsAString& aType,
                              DecoderDoctorDiagnostics* aDiagnostics)
 {
-  nsContentTypeParser parser(aType);
-  nsAutoString mimeType;
-  nsresult rv = parser.GetType(mimeType);
-  if (NS_FAILED(rv))
-    return CANPLAY_NO;
-
-  nsAutoString codecs;
-  rv = parser.GetParameter("codecs", codecs);
-
-  NS_ConvertUTF16toUTF8 mimeTypeUTF8(mimeType);
-  return DecoderTraits::CanHandleMediaType(mimeTypeUTF8.get(),
-                                           NS_SUCCEEDED(rv),
-                                           codecs,
-                                           aDiagnostics);
+  return DecoderTraits::CanHandleContentType(aType, aDiagnostics);
 }
 
 NS_IMETHODIMP
 HTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult)
 {
   DecoderDoctorDiagnostics diagnostics;
   CanPlayStatus canPlay = GetCanPlay(aType, &diagnostics);
   diagnostics.StoreFormatDiagnostics(