зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1176218 - p13. Reject Resolutions that are too big for Windows' decoder - r=jya
The WMFDecoderModule can override Supports(TrackInfo) to reject resolutions that we know are too big for the platform decoder. MozReview-Commit-ID: dU905wjZcJ --HG-- extra : rebase_source : 40e5987deeffff652a88264f157391c0dbc0a2da
This commit is contained in:
Родитель
413e411d7c
Коммит
0e173b53b1
|
@ -25,6 +25,7 @@
|
|||
#include "prsystem.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
#include "MP4Decoder.h"
|
||||
#include "VPXDecoder.h"
|
||||
|
||||
|
@ -193,24 +194,50 @@ bool
|
|||
WMFDecoderModule::SupportsMimeType(const nsACString& aMimeType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics) const
|
||||
{
|
||||
if ((aMimeType.EqualsLiteral("audio/mp4a-latm") ||
|
||||
aMimeType.EqualsLiteral("audio/mp4")) &&
|
||||
UniquePtr<TrackInfo> trackInfo = CreateTrackInfoWithMIMEType(aMimeType);
|
||||
if (!trackInfo) {
|
||||
return false;
|
||||
}
|
||||
return Supports(*trackInfo, aDiagnostics);
|
||||
}
|
||||
|
||||
bool
|
||||
WMFDecoderModule::Supports(const TrackInfo& aTrackInfo,
|
||||
DecoderDoctorDiagnostics* aDiagnostics) const
|
||||
{
|
||||
if ((aTrackInfo.mMimeType.EqualsLiteral("audio/mp4a-latm") ||
|
||||
aTrackInfo.mMimeType.EqualsLiteral("audio/mp4")) &&
|
||||
WMFDecoderModule::HasAAC()) {
|
||||
return true;
|
||||
}
|
||||
if (MP4Decoder::IsH264(aMimeType) && WMFDecoderModule::HasH264()) {
|
||||
if (MP4Decoder::IsH264(aTrackInfo.mMimeType) && WMFDecoderModule::HasH264()) {
|
||||
const VideoInfo* videoInfo = aTrackInfo.GetAsVideoInfo();
|
||||
MOZ_ASSERT(videoInfo);
|
||||
// Check Windows format constraints, based on:
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd797815(v=vs.85).aspx
|
||||
if (IsWin8OrLater()) {
|
||||
// Windows >7 supports at most 4096x2304.
|
||||
if (videoInfo->mImage.width > 4096 || videoInfo->mImage.height > 2304) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// Windows <=7 supports at most 1920x1088.
|
||||
if (videoInfo->mImage.width > 1920 || videoInfo->mImage.height > 1088) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (aMimeType.EqualsLiteral("audio/mpeg") &&
|
||||
if (aTrackInfo.mMimeType.EqualsLiteral("audio/mpeg") &&
|
||||
CanCreateWMFDecoder<CLSID_CMP3DecMediaObject>()) {
|
||||
return true;
|
||||
}
|
||||
if (MediaPrefs::PDMWMFIntelDecoderEnabled() && sDXVAEnabled) {
|
||||
if (VPXDecoder::IsVP8(aMimeType) &&
|
||||
if (VPXDecoder::IsVP8(aTrackInfo.mMimeType) &&
|
||||
CanCreateWMFDecoder<CLSID_WebmMfVp8Dec>()) {
|
||||
return true;
|
||||
}
|
||||
if (VPXDecoder::IsVP9(aMimeType) &&
|
||||
if (VPXDecoder::IsVP9(aTrackInfo.mMimeType) &&
|
||||
CanCreateWMFDecoder<CLSID_WebmMfVp9Dec>()) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ public:
|
|||
|
||||
bool SupportsMimeType(const nsACString& aMimeType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics) const override;
|
||||
bool Supports(const TrackInfo& aTrackInfo,
|
||||
DecoderDoctorDiagnostics* aDiagnostics) const override;
|
||||
|
||||
ConversionRequired
|
||||
DecoderNeedsConversion(const TrackInfo& aConfig) const override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче