mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
WASAPI: Don't stop the device while in the middle of rerouting.
Public issue https://github.com/mackron/miniaudio/issues/582
This commit is contained in:
@@ -41247,6 +41247,9 @@ MA_API ma_result ma_device_stop(ma_device* pDevice)
|
|||||||
return MA_SUCCESS; /* Already stopped. */
|
return MA_SUCCESS; /* Already stopped. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Wait for any rerouting to finish before attempting to stop the device. */
|
||||||
|
ma_mutex_lock(&pDevice->wasapi.rerouteLock);
|
||||||
|
{
|
||||||
ma_mutex_lock(&pDevice->startStopLock);
|
ma_mutex_lock(&pDevice->startStopLock);
|
||||||
{
|
{
|
||||||
/* Starting and stopping are wrapped in a mutex which means we can assert that the device is in a started or paused state. */
|
/* Starting and stopping are wrapped in a mutex which means we can assert that the device is in a started or paused state. */
|
||||||
@@ -41295,6 +41298,8 @@ MA_API ma_result ma_device_stop(ma_device* pDevice)
|
|||||||
pDevice->playback.inputCacheRemaining = 0;
|
pDevice->playback.inputCacheRemaining = 0;
|
||||||
}
|
}
|
||||||
ma_mutex_unlock(&pDevice->startStopLock);
|
ma_mutex_unlock(&pDevice->startStopLock);
|
||||||
|
}
|
||||||
|
ma_mutex_unlock(&pDevice->wasapi.rerouteLock);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user