Back out 248daf8c6362 (bug 852915) for Win7 mochitest-1 orange
This commit is contained in:
@@ -21,27 +21,6 @@ MediaDecoderStateMachine* WMFDecoder::CreateStateMachine()
|
|||||||
return new MediaDecoderStateMachine(this, new WMFReader(this));
|
return new MediaDecoderStateMachine(this, new WMFReader(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
bool
|
|
||||||
WMFDecoder::IsMP3Supported()
|
|
||||||
{
|
|
||||||
if (!MediaDecoder::IsWMFEnabled()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (WinUtils::GetWindowsVersion() != WinUtils::WIN7_VERSION) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// We're on Windows 7. MP3 support is disabled if no service pack
|
|
||||||
// is installed, as it's crashy on Win7 SP0.
|
|
||||||
UINT spMajorVer = 0, spMinorVer = 0;
|
|
||||||
if (!WinUtils::GetWindowsServicePackVersion(spMajorVer, spMinorVer)) {
|
|
||||||
// Um... We can't determine the service pack version... Just block
|
|
||||||
// MP3 as a precaution...
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return spMajorVer != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WMFDecoder::GetSupportedCodecs(const nsACString& aType,
|
WMFDecoder::GetSupportedCodecs(const nsACString& aType,
|
||||||
char const *const ** aCodecList)
|
char const *const ** aCodecList)
|
||||||
@@ -51,15 +30,13 @@ WMFDecoder::GetSupportedCodecs(const nsACString& aType,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Assume that if LoadDLLs() didn't fail, we can playback the types that
|
// Assume that if LoadDLLs() didn't fail, we can playback the types that
|
||||||
// we know should be supported by Windows Media Foundation.
|
// we know should be supported on Windows 7+ using WMF.
|
||||||
static char const *const mp3AudioCodecs[] = {
|
static char const *const mp3AudioCodecs[] = {
|
||||||
"mp3",
|
"mp3",
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
if ((aType.EqualsASCII("audio/mpeg") || aType.EqualsASCII("audio/mp3")) &&
|
if (aType.EqualsASCII("audio/mpeg") ||
|
||||||
IsMP3Supported()) {
|
aType.EqualsASCII("audio/mp3")) {
|
||||||
// Note: We block MP3 playback on Window 7 SP0 since it seems to crash
|
|
||||||
// in some circumstances.
|
|
||||||
if (aCodecList) {
|
if (aCodecList) {
|
||||||
*aCodecList = mp3AudioCodecs;
|
*aCodecList = mp3AudioCodecs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ public:
|
|||||||
// Returns true if the WMF backend is preffed on, and we're running on a
|
// Returns true if the WMF backend is preffed on, and we're running on a
|
||||||
// version of Windows which is likely to support WMF.
|
// version of Windows which is likely to support WMF.
|
||||||
static bool IsEnabled();
|
static bool IsEnabled();
|
||||||
|
|
||||||
// Returns true if MP3 decoding is enabled on this system. We block
|
|
||||||
// MP3 playback on Windows 7 SP0, since it's crashy on that platform.
|
|
||||||
static bool IsMP3Supported();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|||||||
@@ -388,28 +388,6 @@ WMFReader::ConfigureVideoDecoder()
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
GetSupportedAudioCodecs(const GUID** aCodecs, uint32_t* aNumCodecs)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aCodecs);
|
|
||||||
MOZ_ASSERT(aNumCodecs);
|
|
||||||
|
|
||||||
if (WMFDecoder::IsMP3Supported()) {
|
|
||||||
static const GUID codecs[] = {
|
|
||||||
MFAudioFormat_AAC,
|
|
||||||
MFAudioFormat_MP3
|
|
||||||
};
|
|
||||||
*aCodecs = codecs;
|
|
||||||
*aNumCodecs = NS_ARRAY_LENGTH(codecs);
|
|
||||||
} else {
|
|
||||||
static const GUID codecs[] = {
|
|
||||||
MFAudioFormat_AAC
|
|
||||||
};
|
|
||||||
*aCodecs = codecs;
|
|
||||||
*aNumCodecs = NS_ARRAY_LENGTH(codecs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
WMFReader::ConfigureAudioDecoder()
|
WMFReader::ConfigureAudioDecoder()
|
||||||
{
|
{
|
||||||
@@ -421,15 +399,15 @@ WMFReader::ConfigureAudioDecoder()
|
|||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const GUID* codecs;
|
static const GUID MP4AudioTypes[] = {
|
||||||
uint32_t numCodecs = 0;
|
MFAudioFormat_AAC,
|
||||||
GetSupportedAudioCodecs(&codecs, &numCodecs);
|
MFAudioFormat_MP3
|
||||||
|
};
|
||||||
HRESULT hr = ConfigureSourceReaderStream(mSourceReader,
|
HRESULT hr = ConfigureSourceReaderStream(mSourceReader,
|
||||||
MF_SOURCE_READER_FIRST_AUDIO_STREAM,
|
MF_SOURCE_READER_FIRST_AUDIO_STREAM,
|
||||||
MFAudioFormat_Float,
|
MFAudioFormat_Float,
|
||||||
codecs,
|
MP4AudioTypes,
|
||||||
numCodecs);
|
NS_ARRAY_LENGTH(MP4AudioTypes));
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
NS_WARNING("Failed to configure WMF Audio decoder for PCM output");
|
NS_WARNING("Failed to configure WMF Audio decoder for PCM output");
|
||||||
return hr;
|
return hr;
|
||||||
|
|||||||
@@ -73,23 +73,6 @@ WinUtils::GetWindowsVersion()
|
|||||||
return static_cast<WinVersion>(version);
|
return static_cast<WinVersion>(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
bool
|
|
||||||
WinUtils::GetWindowsServicePackVersion(UINT& aOutMajor, UINT& aOutMinor)
|
|
||||||
{
|
|
||||||
OSVERSIONINFOEX osInfo;
|
|
||||||
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
|
||||||
// This cast is safe and supposed to be here, don't worry
|
|
||||||
if (!::GetVersionEx((OSVERSIONINFO*)&osInfo)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
aOutMajor = osInfo.wServicePackMajor;
|
|
||||||
aOutMinor = osInfo.wServicePackMinor;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool
|
bool
|
||||||
WinUtils::PeekMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
|
WinUtils::PeekMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,
|
||||||
|
|||||||
@@ -49,10 +49,6 @@ public:
|
|||||||
};
|
};
|
||||||
static WinVersion GetWindowsVersion();
|
static WinVersion GetWindowsVersion();
|
||||||
|
|
||||||
// Retrieves the Service Pack version number.
|
|
||||||
// Returns true on success, false on failure.
|
|
||||||
static bool GetWindowsServicePackVersion(UINT& aOutMajor, UINT& aOutMinor);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PeekMessage() and GetMessage() are wrapper methods for PeekMessageW(),
|
* PeekMessage() and GetMessage() are wrapper methods for PeekMessageW(),
|
||||||
* GetMessageW(), ITfMessageMgr::PeekMessageW() and
|
* GetMessageW(), ITfMessageMgr::PeekMessageW() and
|
||||||
|
|||||||
Reference in New Issue
Block a user