winepulse: Move pulse stream destruction to unix lib.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5477f2b015
commit
0eeefec6c5
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue