aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cubeb_wasapi.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp
index c28be38..d55be36 100644
--- a/src/cubeb_wasapi.cpp
+++ b/src/cubeb_wasapi.cpp
@@ -1419,6 +1419,7 @@ static unsigned int __stdcall wasapi_stream_render_loop(LPVOID stream)
continue;
}
case WAIT_OBJECT_0 + 1: { /* reconfigure */
+ auto_lock lock(stm->stream_reset_lock);
XASSERT(stm->output_client || stm->input_client);
LOG("Reconfiguring the stream");
/* Close the stream */
@@ -1431,23 +1432,20 @@ static unsigned int __stdcall wasapi_stream_render_loop(LPVOID stream)
was_running = stm->input_client->Stop() == S_OK;
LOG("Input stopped.");
}
- {
- auto_lock lock(stm->stream_reset_lock);
- close_wasapi_stream(stm);
- LOG("Stream closed.");
- /* Reopen a stream and start it immediately. This will automatically
- pick the new default device for this role. */
- int r = setup_wasapi_stream(stm);
- if (r != CUBEB_OK) {
- LOG("Error setting up the stream during reconfigure.");
- /* Don't destroy the stream here, since we expect the caller to do
- so after the error has propagated via the state callback. */
- is_playing = false;
- hr = E_FAIL;
- continue;
- }
- LOG("Stream setup successfuly.");
+ close_wasapi_stream(stm);
+ LOG("Stream closed.");
+ /* Reopen a stream and start it immediately. This will automatically
+ pick the new default device for this role. */
+ int r = setup_wasapi_stream(stm);
+ if (r != CUBEB_OK) {
+ LOG("Error setting up the stream during reconfigure.");
+ /* Don't destroy the stream here, since we expect the caller to do
+ so after the error has propagated via the state callback. */
+ is_playing = false;
+ hr = E_FAIL;
+ continue;
}
+ LOG("Stream setup successfuly.");
XASSERT(stm->output_client || stm->input_client);
if (was_running && stm->output_client) {
hr = stm->output_client->Start();