From: Connor McAdams cmcadams@codeweavers.com
This avoids a hang where samples are queued after the thread is exited due to receiving EOS, but the thread is no longer processing samples.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57632 Signed-off-by: Connor McAdams cmcadams@codeweavers.com --- dlls/quartz/dsoundrender.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 46782022963..e8e5eb2b69f 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -544,8 +544,20 @@ static HRESULT dsound_render_sink_end_flush(struct strmbase_sink *iface) struct dsound_render *filter = impl_from_strmbase_pin(&iface->pin);
EnterCriticalSection(&filter->filter.stream_cs); + if (filter->eos && filter->filter.state != State_Stopped) + { + WaitForSingleObject(filter->render_thread, INFINITE); + CloseHandle(filter->render_thread); + + filter->render_thread_shutdown = false; + if (!(filter->render_thread = CreateThread(NULL, 0, render_thread_run, filter, 0, NULL))) + { + LeaveCriticalSection(&filter->filter.stream_cs); + return HRESULT_FROM_WIN32(GetLastError()); + } + filter->eos = FALSE; + }
- filter->eos = FALSE; ResetEvent(filter->flush_event);
if (filter->dsbuffer)