Bug 1350246 - [Part6] Use DecoderTraits::IsHttpLiveStreamingType to implement HLSDecoder::IsSupportedType and use HLSDecoder::IsSupportedType to implement the following APIs for mimetype of HLS. r=jya

(1) Check if we should instantiate HLSDecoder in DecoderTraits::InstantiateDecoder.
(2) Reply CANPLAY_MAYBE in CanHandleMediaType on Fennec.

MozReview-Commit-ID: 4Y6Ju5yk6ha

--HG--
extra : rebase_source : 0755d580ac3e415849afc9f7f5f6ffd2d0dfc870
This commit is contained in:
James Cheng 2017-05-31 18:37:23 +08:00
parent d994078234
commit 95c4d8f668
2 changed files with 17 additions and 1 deletions

View File

@ -22,6 +22,9 @@
#include "AndroidMediaReader.h"
#include "AndroidMediaPluginHost.h"
#endif
#ifdef MOZ_ANDROID_HLS_SUPPORT
#include "HLSDecoder.h"
#endif
#ifdef MOZ_FMP4
#include "MP4Decoder.h"
#include "MP4Demuxer.h"
@ -165,6 +168,12 @@ CanHandleMediaType(const MediaContainerType& aType,
{
MOZ_ASSERT(NS_IsMainThread());
#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);
}
@ -263,6 +272,12 @@ InstantiateDecoder(const MediaContainerType& aType,
MOZ_ASSERT(NS_IsMainThread());
RefPtr<MediaDecoder> decoder;
#ifdef MOZ_ANDROID_HLS_SUPPORT
if (HLSDecoder::IsSupportedType(aType)) {
decoder = new HLSDecoder(aInit);
return decoder.forget();
}
#endif
#ifdef MOZ_FMP4
if (MP4Decoder::IsSupportedType(aType, aDiagnostics)) {
decoder = new MP4Decoder(aInit);

View File

@ -47,7 +47,8 @@ HLSDecoder::IsEnabled()
bool
HLSDecoder::IsSupportedType(const MediaContainerType& aContainerType)
{
return false;
return IsEnabled() &&
DecoderTraits::IsHttpLiveStreamingType(aContainerType);
}
} // namespace mozilla