Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions os/windows/AudioInputWASAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ void AudioInputWASAPI::ActuallySetCurrentDevice(std::string deviceID){
//device->AddRef();
break;
}
SafeRelease(&device);
}
if (deviceCollection)
SafeRelease(&deviceCollection);
SafeRelease(&deviceCollection);

if (!device) {
LOGW("Requested device not found, using default");
Expand Down
19 changes: 16 additions & 3 deletions os/windows/AudioOutputWASAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,20 @@ void AudioOutputWASAPI::ActuallySetCurrentDevice(std::string deviceID){

if(deviceID=="default"){
isDefaultDevice=true;
res=enumerator->GetDefaultAudioEndpoint(eRender, eCommunications, &device);
IMMDevice* temp_device;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks strange since all other variables are in camelCase

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Y

res = enumerator->GetDefaultAudioEndpoint(eRender, eCommunications, &temp_device);
CHECK_RES(res, "GetDefaultAudioEndpoint");

wchar_t* temp_devID;
res = temp_device->GetId(&temp_devID);
CHECK_RES(res, "get default device id");

res = enumerator->GetDevice(temp_devID, &device);
CHECK_RES(res, "GetDeviceByID");

CoTaskMemFree(temp_devID);
SafeRelease(&temp_device);

}else{
IMMDeviceCollection *deviceCollection = NULL;

Expand Down Expand Up @@ -245,9 +257,10 @@ void AudioOutputWASAPI::ActuallySetCurrentDevice(std::string deviceID){
this->device=device;
break;
}
SafeRelease(&device);
}
if(deviceCollection)
SafeRelease(&deviceCollection);
SafeRelease(&deviceCollection);

if (!device) {
LOGW("Requested device not found, using default");
ActuallySetCurrentDevice("default");
Expand Down