output/wasapi: add method WasapiOutputThread::InterruptWaiter()
This commit is contained in:
@@ -209,6 +209,10 @@ public:
|
|||||||
data_poped.Wait();
|
data_poped.Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InterruptWaiter() noexcept {
|
||||||
|
data_poped.Set();
|
||||||
|
}
|
||||||
|
|
||||||
void CheckException() {
|
void CheckException() {
|
||||||
if (error.occur.load()) {
|
if (error.occur.load()) {
|
||||||
std::rethrow_exception(error.ptr);
|
std::rethrow_exception(error.ptr);
|
||||||
@@ -395,7 +399,7 @@ try {
|
|||||||
new_data_size = spsc_buffer.pop(data, write_size);
|
new_data_size = spsc_buffer.pop(data, write_size);
|
||||||
std::fill_n(data + new_data_size,
|
std::fill_n(data + new_data_size,
|
||||||
write_size - new_data_size, 0);
|
write_size - new_data_size, 0);
|
||||||
data_poped.Set();
|
InterruptWaiter();
|
||||||
} else {
|
} else {
|
||||||
mode = AUDCLNT_BUFFERFLAGS_SILENT;
|
mode = AUDCLNT_BUFFERFLAGS_SILENT;
|
||||||
FormatDebug(wasapi_output_domain,
|
FormatDebug(wasapi_output_domain,
|
||||||
@@ -406,9 +410,8 @@ try {
|
|||||||
error.ptr = std::current_exception();
|
error.ptr = std::current_exception();
|
||||||
error.occur.store(true);
|
error.occur.store(true);
|
||||||
|
|
||||||
/* wake up the client thread which may be inside
|
/* wake up the client thread which may be inside Wait() */
|
||||||
WaitDataPoped() */
|
InterruptWaiter();
|
||||||
data_poped.Set();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioOutput *
|
AudioOutput *
|
||||||
@@ -661,7 +664,7 @@ WasapiOutput::Interrupt() noexcept
|
|||||||
{
|
{
|
||||||
if (thread) {
|
if (thread) {
|
||||||
not_interrupted.clear();
|
not_interrupted.clear();
|
||||||
thread->data_poped.Set();
|
thread->InterruptWaiter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user