Back out 248daf8c6362 (bug 852915) for Win7 mochitest-1 orange

This commit is contained in:
Phil Ringnalda
2013-04-17 23:23:33 -07:00
parent 9efe18946c
commit 05c22c8035
5 changed files with 9 additions and 79 deletions

View File

@@ -21,27 +21,6 @@ MediaDecoderStateMachine* WMFDecoder::CreateStateMachine()
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
WMFDecoder::GetSupportedCodecs(const nsACString& aType,
char const *const ** aCodecList)
@@ -51,15 +30,13 @@ WMFDecoder::GetSupportedCodecs(const nsACString& aType,
return false;
// 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[] = {
"mp3",
nullptr
};
if ((aType.EqualsASCII("audio/mpeg") || aType.EqualsASCII("audio/mp3")) &&
IsMP3Supported()) {
// Note: We block MP3 playback on Window 7 SP0 since it seems to crash
// in some circumstances.
if (aType.EqualsASCII("audio/mpeg") ||
aType.EqualsASCII("audio/mp3")) {
if (aCodecList) {
*aCodecList = mp3AudioCodecs;
}

View File

@@ -42,10 +42,6 @@ public:
// Returns true if the WMF backend is preffed on, and we're running on a
// version of Windows which is likely to support WMF.
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

View File

@@ -388,28 +388,6 @@ WMFReader::ConfigureVideoDecoder()
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
WMFReader::ConfigureAudioDecoder()
{
@@ -421,15 +399,15 @@ WMFReader::ConfigureAudioDecoder()
return S_OK;
}
const GUID* codecs;
uint32_t numCodecs = 0;
GetSupportedAudioCodecs(&codecs, &numCodecs);
static const GUID MP4AudioTypes[] = {
MFAudioFormat_AAC,
MFAudioFormat_MP3
};
HRESULT hr = ConfigureSourceReaderStream(mSourceReader,
MF_SOURCE_READER_FIRST_AUDIO_STREAM,
MFAudioFormat_Float,
codecs,
numCodecs);
MP4AudioTypes,
NS_ARRAY_LENGTH(MP4AudioTypes));
if (FAILED(hr)) {
NS_WARNING("Failed to configure WMF Audio decoder for PCM output");
return hr;

View File

@@ -73,23 +73,6 @@ WinUtils::GetWindowsVersion()
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 */
bool
WinUtils::PeekMessage(LPMSG aMsg, HWND aWnd, UINT aFirstMessage,

View File

@@ -49,10 +49,6 @@ public:
};
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(),
* GetMessageW(), ITfMessageMgr::PeekMessageW() and