зеркало из https://github.com/mozilla/cubeb.git
wasapi: Flag cubeb_stream as inactive when stopped, avoid reconfiguring inactive streams from render thread.
This commit is contained in:
Родитель
779f024958
Коммит
68084e902e
|
@ -452,6 +452,9 @@ struct cubeb_stream {
|
|||
* called and the render loop thread has exited, destroy this stream object.
|
||||
*/
|
||||
LONG ref_count = 0;
|
||||
|
||||
/* True if the stream is active, false if inactive. */
|
||||
bool active = false;
|
||||
};
|
||||
|
||||
class monitor_device_notifications {
|
||||
|
@ -1420,6 +1423,11 @@ static unsigned int __stdcall wasapi_stream_render_loop(LPVOID stream)
|
|||
}
|
||||
case WAIT_OBJECT_0 + 1: { /* reconfigure */
|
||||
auto_lock lock(stm->stream_reset_lock);
|
||||
if (!stm->active) {
|
||||
/* Avoid reconfiguring, stream start will handle it. */
|
||||
LOG("Stream is not active, ignoring reconfigure.");
|
||||
continue;
|
||||
}
|
||||
XASSERT(stm->output_client || stm->input_client);
|
||||
LOG("Reconfiguring the stream");
|
||||
/* Close the stream */
|
||||
|
@ -2985,6 +2993,8 @@ wasapi_stream_start(cubeb_stream * stm)
|
|||
}
|
||||
}
|
||||
|
||||
stm->active = true;
|
||||
|
||||
stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_STARTED);
|
||||
|
||||
return CUBEB_OK;
|
||||
|
@ -3015,6 +3025,8 @@ wasapi_stream_stop(cubeb_stream * stm)
|
|||
}
|
||||
}
|
||||
|
||||
stm->active = false;
|
||||
|
||||
wasapi_state_callback(stm, stm->user_ptr, CUBEB_STATE_STOPPED);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче