Permalink
Browse files

[WIN32] fixed: it shouldn't happen but according to some crash dumps …

…varName doesn't contain a WAVEFORMATEX even though the return status is S_OK.
  • Loading branch information...
1 parent 07ae1d6 commit 9ff141ab091bdbb77f84ee24545d0718bb9352b3 @wsoltys wsoltys committed Jul 27, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
@@ -588,13 +588,13 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList)
IAudioClient *pClient;
hr = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pClient);
if (FAILED(hr))
- {
- CLog::Log(LOGERROR, __FUNCTION__": Activate device failed (%s)", WASAPIErrToStr(hr));
- }
+ {
+ CLog::Log(LOGERROR, __FUNCTION__": Activate device failed (%s)", WASAPIErrToStr(hr));
+ }
//hr = pClient->GetMixFormat(&pwfxex);
hr = pProperty->GetValue(PKEY_AudioEngine_DeviceFormat, &varName);
- if (SUCCEEDED(hr))
+ if (SUCCEEDED(hr) && varName.blob.cbSize > 0)
{
WAVEFORMATEX* smpwfxex = (WAVEFORMATEX*)varName.blob.pBlobData;
deviceInfo.m_channels = layoutsByChCount[std::min(smpwfxex->nChannels, (WORD) 2)];
@@ -604,7 +604,7 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList)
}
else
{
- CLog::Log(LOGERROR, __FUNCTION__": GetMixFormat failed (%s)", WASAPIErrToStr(hr));
+ CLog::Log(LOGERROR, __FUNCTION__": Getting DeviceFormat failed (%s)", WASAPIErrToStr(hr));
}
pClient->Release();

0 comments on commit 9ff141a

Please sign in to comment.