Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winepulse.drv/mmdevdrv.c | 19 ++----------------- dlls/winepulse.drv/pulse.c | 24 ++++++++++++++++++++++++ dlls/winepulse.drv/unixlib.h | 1 + 3 files changed, 27 insertions(+), 17 deletions(-)
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Tue, May 11, 2021 at 06:31:34PM +0200, Jacek Caban wrote:
Signed-off-by: Jacek Caban jacek@codeweavers.com
dlls/winepulse.drv/mmdevdrv.c | 19 ++----------------- dlls/winepulse.drv/pulse.c | 24 ++++++++++++++++++++++++ dlls/winepulse.drv/unixlib.h | 1 + 3 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 1531a2c0075..4c962069c97 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -868,24 +868,9 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) TRACE("(%p) Refcount now %u\n", This, ref); if (!ref) { if (This->pulse_stream) {
if(This->timer) {
This->pulse_stream->please_quit = TRUE;
WaitForSingleObject(This->timer, INFINITE);
CloseHandle(This->timer);
}
pulse->lock();
if (PA_STREAM_IS_GOOD(pa_stream_get_state(This->pulse_stream->stream))) {
pa_stream_disconnect(This->pulse_stream->stream);
while (PA_STREAM_IS_GOOD(pa_stream_get_state(This->pulse_stream->stream)))
pulse->cond_wait();
}
pa_stream_unref(This->pulse_stream->stream);
HeapFree(GetProcessHeap(), 0, This->pulse_stream->tmp_buffer);
HeapFree(GetProcessHeap(), 0, This->pulse_stream->peek_buffer);
HeapFree(GetProcessHeap(), 0, This->pulse_stream->local_buffer);
HeapFree(GetProcessHeap(), 0, This->pulse_stream);
pulse->release_stream(This->pulse_stream, This->timer); This->pulse_stream = NULL;
pulse->lock(); list_remove(&This->entry); pulse->unlock(); }
diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 5f4998e641f..23b362c8689 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -477,6 +477,29 @@ fail: return E_FAIL; }
+static void WINAPI pulse_release_stream(struct pulse_stream *stream, HANDLE timer) +{
- if(timer) {
stream->please_quit = TRUE;
NtWaitForSingleObject(timer, FALSE, NULL);
NtClose(timer);
- }
- pulse_lock();
- if (PA_STREAM_IS_GOOD(pa_stream_get_state(stream->stream))) {
pa_stream_disconnect(stream->stream);
while (PA_STREAM_IS_GOOD(pa_stream_get_state(stream->stream)))
pulse_cond_wait();
- }
- pa_stream_unref(stream->stream);
- pulse_unlock();
- RtlFreeHeap(GetProcessHeap(), 0, stream->tmp_buffer);
- RtlFreeHeap(GetProcessHeap(), 0, stream->peek_buffer);
- RtlFreeHeap(GetProcessHeap(), 0, stream->local_buffer);
- RtlFreeHeap(GetProcessHeap(), 0, stream);
+}
static const struct unix_funcs unix_funcs = { pulse_lock, @@ -485,6 +508,7 @@ static const struct unix_funcs unix_funcs = pulse_broadcast, pulse_main_loop, pulse_connect,
- pulse_release_stream, pulse_test_connect,
};
diff --git a/dlls/winepulse.drv/unixlib.h b/dlls/winepulse.drv/unixlib.h index 89d3c05611a..d02ab4fdf07 100644 --- a/dlls/winepulse.drv/unixlib.h +++ b/dlls/winepulse.drv/unixlib.h @@ -65,5 +65,6 @@ struct unix_funcs void (WINAPI *broadcast)(void); void (WINAPI *main_loop)(void); HRESULT (WINAPI *connect)(const char *name, pa_context **ret);
- void (WINAPI *release_stream)(struct pulse_stream *stream, HANDLE timer); HRESULT (WINAPI *test_connect)(const char *name, struct pulse_config *config);
};