Bug 1409178 - Merge InstantiateDecoder and DecoderTraits::CreateDecoder. r?jwwang draft
authorChris Pearce <cpearce@mozilla.com>
Mon, 16 Oct 2017 22:42:32 +0200
changeset 681028 12406089a325ea5818822b72b1d90382f07eb5a3
parent 681027 4f2392001b76d171ea45e0f48bd1aedeb869d9ca
child 681029 41c19bdf82c2478f6ec20656a859a95e3d3422e8
child 681033 2479a84f108d4805fb61f2e1fd1d796c93e7f26e
push id84732
push userbmo:cpearce@mozilla.com
push dateMon, 16 Oct 2017 21:22:22 +0000
reviewersjwwang
bugs1409178
milestone58.0a1
Bug 1409178 - Merge InstantiateDecoder and DecoderTraits::CreateDecoder. r?jwwang CreateDecoder is the only caller of InstantiateDecoder, and all CreateDecoder does is call InstantiateDecoder. MozReview-Commit-ID: KwwL2el8L4x
dom/media/DecoderTraits.cpp
--- a/dom/media/DecoderTraits.cpp
+++ b/dom/media/DecoderTraits.cpp
@@ -219,20 +219,20 @@ bool DecoderTraits::ShouldHandleMediaTyp
         pluginHost->HavePluginForType(containerType->Type().AsString())) {
       return false;
     }
   }
 
   return CanHandleMediaType(*containerType, aDiagnostics) != CANPLAY_NO;
 }
 
-// Instantiates but does not initialize decoder.
-static already_AddRefed<ChannelMediaDecoder>
-InstantiateDecoder(MediaDecoderInit& aInit,
-                   DecoderDoctorDiagnostics* aDiagnostics)
+/* static */
+already_AddRefed<ChannelMediaDecoder>
+DecoderTraits::CreateDecoder(MediaDecoderInit& aInit,
+                             DecoderDoctorDiagnostics* aDiagnostics)
 {
   MOZ_ASSERT(NS_IsMainThread());
   RefPtr<ChannelMediaDecoder> decoder;
 
   const MediaContainerType& type = aInit.mContainerType;
   if (DecoderTraits::IsSupportedType(type)) {
     decoder = new ChannelMediaDecoder(aInit);
     return decoder.forget();
@@ -242,25 +242,16 @@ InstantiateDecoder(MediaDecoderInit& aIn
     // We don't have an HLS decoder.
     Telemetry::Accumulate(Telemetry::MEDIA_HLS_DECODER_SUCCESS, false);
   }
 
   return nullptr;
 }
 
 /* static */
-already_AddRefed<ChannelMediaDecoder>
-DecoderTraits::CreateDecoder(MediaDecoderInit& aInit,
-                             DecoderDoctorDiagnostics* aDiagnostics)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  return InstantiateDecoder(aInit, aDiagnostics);
-}
-
-/* static */
 MediaFormatReader*
 DecoderTraits::CreateReader(const MediaContainerType& aType,
                             MediaFormatReaderInit& aInit)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MediaFormatReader* decoderReader = nullptr;
   MediaResource* resource = aInit.mResource;