Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/wineoss.drv/mmdevdrv.c | 8 ++++---- dlls/wineoss.drv/oss.c | 11 +++++++++++ dlls/wineoss.drv/unixlib.h | 7 +++++++ 3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index c921b4975c9..cdd9b09bff7 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -1596,6 +1596,7 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, AudioSessionState *state) { AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); + struct is_started_params params; ACImpl *client;
TRACE("(%p)->(%p)\n", This, state); @@ -1612,14 +1613,13 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, }
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){ - oss_lock(client->stream); - if(client->stream->playing){ + params.stream = client->stream; + OSS_CALL(is_started, ¶ms); + if(params.result == S_OK){ *state = AudioSessionStateActive; - oss_unlock(client->stream); LeaveCriticalSection(&g_sessions_lock); return S_OK; } - oss_unlock(client->stream); }
LeaveCriticalSection(&g_sessions_lock); diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index a39b0bc4f66..79f2e994d89 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -1336,6 +1336,16 @@ static NTSTATUS set_event_handle(void *args) return oss_unlock_result(stream, ¶ms->result, S_OK); }
+static NTSTATUS is_started(void *args) +{ + struct is_started_params *params = args; + struct oss_stream *stream = params->stream; + + oss_lock(stream); + + return oss_unlock_result(stream, ¶ms->result, stream->playing ? S_OK : S_FALSE); +} + unixlib_entry_t __wine_unix_call_funcs[] = { test_connect, @@ -1359,4 +1369,5 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_frequency, get_position, set_event_handle, + is_started, }; diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index 982b11ec44f..ed93f0836b1 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -215,6 +215,12 @@ struct set_event_handle_params HRESULT result; };
+struct is_started_params +{ + struct oss_stream *stream; + HRESULT result; +}; + enum oss_funcs { oss_test_connect, @@ -238,6 +244,7 @@ enum oss_funcs oss_get_frequency, oss_get_position, oss_set_event_handle, + oss_is_started, };
extern unixlib_handle_t oss_handle;