Merge branch 'master' into alpha-kung

This commit is contained in:
Kung-vr
2019-01-28 02:53:24 +09:00
@@ -457,7 +457,7 @@ IMMDevice*
LPCWSTR id ) LPCWSTR id )
{ {
IMMDevice* pDevice; IMMDevice* pDevice;
if ( deviceEnumerator->GetDevice( id, &pDevice ) < 0 ) if ( !id || deviceEnumerator->GetDevice( id, &pDevice ) < 0 )
{ {
return nullptr; return nullptr;
} }
@@ -606,6 +606,10 @@ AudioManagerWindows::OnDefaultDeviceChanged( EDataFlow flow,
micAudioEndpointVolume micAudioEndpointVolume
= getAudioEndpointVolume( micAudioDevice ); = getAudioEndpointVolume( micAudioDevice );
} }
else if ( !pwstrDefaultDeviceId )
{
LOG( WARNING ) << "No recording device available.";
}
else else
{ {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>
@@ -632,7 +636,11 @@ AudioManagerWindows::OnDefaultDeviceChanged( EDataFlow flow,
playbackAudioDevice->Release(); playbackAudioDevice->Release();
} }
playbackAudioDevice = device; playbackAudioDevice = device;
if ( !playbackAudioDevice ) if ( !pwstrDefaultDeviceId )
{
LOG( WARNING ) << "No playback device available.";
}
else if ( !playbackAudioDevice )
{ {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>
converter; converter;