Bug 1409664 - P12. Don't attempt to play non-supported AAC sampling rate. r=padenot

Summary:
We know those sampling rate aren't supported and cause initialization errors later.

Depends on D1624

Tags: #secure-revision

Bug #: 1409664

Differential Revision: https://phabricator.services.mozilla.com/D1625
This commit is contained in:
Jean-Yves Avenard 2018-06-08 16:24:07 +02:00
Родитель d346b32eb9
Коммит 0c1b59ee76
1 изменённых файлов: 13 добавлений и 0 удалений

Просмотреть файл

@ -31,6 +31,8 @@
#include "prsystem.h"
#include "nsIXULRuntime.h"
#include "mozilla/mscom/EnsureMTA.h"
#include <algorithm>
#include <vector>
extern const GUID CLSID_WebmMfVpxDec;
extern const GUID CLSID_AMDWebmMfVp9Dec;
@ -204,6 +206,17 @@ WMFDecoderModule::Supports(const TrackInfo& aTrackInfo,
if ((aTrackInfo.mMimeType.EqualsLiteral("audio/mp4a-latm") ||
aTrackInfo.mMimeType.EqualsLiteral("audio/mp4")) &&
WMFDecoderModule::HasAAC()) {
const auto audioInfo = aTrackInfo.GetAsAudioInfo();
if (audioInfo && audioInfo->mRate > 0) {
// Supported sampling rates per:
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd742784(v=vs.85).aspx
const std::vector<uint32_t> frequencies = {
8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000,
};
return std::find(frequencies.begin(),
frequencies.end(),
audioInfo->mRate) != frequencies.end();
}
return true;
}
if (MP4Decoder::IsH264(aTrackInfo.mMimeType) && WMFDecoderModule::HasH264()) {