1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 23:32:26 +00:00

ao_wasapi: just use a pointer to the deviceID in change_notify

Rather than creating a new string from the device instance. This will allow
moving the change_init to the main thread before the device is loaded.
This commit is contained in:
Kevin Mitchell 2015-12-29 03:13:52 -08:00
parent 029e31f1c5
commit cb8b0cc329

View File

@ -226,8 +226,7 @@ HRESULT wasapi_change_init(struct ao *ao, bool is_hotplug)
MP_DBG(ao, "Monitoring for hotplug events\n");
} else {
// Get the device string to compare with the pwstrDeviceId
hr = IMMDevice_GetId(state->pDevice, &change->monitored);
EXIT_ON_ERROR(hr);
change->monitored = state->deviceID;
MP_VERBOSE(ao, "Monitoring changes in device %S\n", change->monitored);
}
@ -249,6 +248,5 @@ void wasapi_change_uninit(struct ao *ao)
change->pEnumerator, (IMMNotificationClient *)change);
}
if (change->monitored) CoTaskMemFree(change->monitored);
SAFE_RELEASE(change->pEnumerator, IMMDeviceEnumerator_Release(change->pEnumerator));
}