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
--- 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;