Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/winecoreaudio.drv/coreaudio.c | 14 ++++++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 8 ++++---- dlls/winecoreaudio.drv/unixlib.h | 7 +++++++ 3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index f59723d48f6..9636975607c 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1541,6 +1541,19 @@ static NTSTATUS get_frequency(void *args) return STATUS_SUCCESS; }
+static NTSTATUS is_started(void *args) +{ + struct is_started_params *params = args; + struct coreaudio_stream *stream = params->stream; + + if(stream->playing) + params->result = S_OK; + else + params->result = S_FALSE; + + return STATUS_SUCCESS; +} + unixlib_entry_t __wine_unix_call_funcs[] = { get_endpoint_ids, @@ -1561,4 +1574,5 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_next_packet_size, get_position, get_frequency, + is_started, }; diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index f79d808d8ed..07260c16ff0 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -1628,6 +1628,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); @@ -1644,14 +1645,13 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, }
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){ - OSSpinLockLock(&client->stream->lock); - if(client->stream->playing){ + params.stream = client->stream; + UNIX_CALL(is_started, ¶ms); + if(params.result == S_OK){ *state = AudioSessionStateActive; - OSSpinLockUnlock(&client->stream->lock); LeaveCriticalSection(&g_sessions_lock); return S_OK; } - OSSpinLockUnlock(&client->stream->lock); }
LeaveCriticalSection(&g_sessions_lock); diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index 5dcefe2eb05..aac2df15f47 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -188,6 +188,12 @@ struct get_frequency_params UINT64 *freq; };
+struct is_started_params +{ + struct coreaudio_stream *stream; + HRESULT result; +}; + enum unix_funcs { unix_get_endpoint_ids, @@ -208,6 +214,7 @@ enum unix_funcs unix_get_next_packet_size, unix_get_position, unix_get_frequency, + unix_is_started, };
extern unixlib_handle_t coreaudio_handle;
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Wed, Nov 24, 2021 at 11:26:47AM +0000, Huw Davies wrote:
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/winecoreaudio.drv/coreaudio.c | 14 ++++++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 8 ++++---- dlls/winecoreaudio.drv/unixlib.h | 7 +++++++ 3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index f59723d48f6..9636975607c 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1541,6 +1541,19 @@ static NTSTATUS get_frequency(void *args) return STATUS_SUCCESS; }
+static NTSTATUS is_started(void *args) +{
- struct is_started_params *params = args;
- struct coreaudio_stream *stream = params->stream;
- if(stream->playing)
params->result = S_OK;
- else
params->result = S_FALSE;
- return STATUS_SUCCESS;
+}
unixlib_entry_t __wine_unix_call_funcs[] = { get_endpoint_ids, @@ -1561,4 +1574,5 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_next_packet_size, get_position, get_frequency,
- is_started,
}; diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index f79d808d8ed..07260c16ff0 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -1628,6 +1628,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);
@@ -1644,14 +1645,13 @@ static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, }
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){
OSSpinLockLock(&client->stream->lock);
if(client->stream->playing){
params.stream = client->stream;
UNIX_CALL(is_started, ¶ms);
if(params.result == S_OK){ *state = AudioSessionStateActive;
OSSpinLockUnlock(&client->stream->lock); LeaveCriticalSection(&g_sessions_lock); return S_OK; }
OSSpinLockUnlock(&client->stream->lock);
}
LeaveCriticalSection(&g_sessions_lock);
diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index 5dcefe2eb05..aac2df15f47 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -188,6 +188,12 @@ struct get_frequency_params UINT64 *freq; };
+struct is_started_params +{
- struct coreaudio_stream *stream;
- HRESULT result;
+};
enum unix_funcs { unix_get_endpoint_ids, @@ -208,6 +214,7 @@ enum unix_funcs unix_get_next_packet_size, unix_get_position, unix_get_frequency,
- unix_is_started,
};
extern unixlib_handle_t coreaudio_handle;
2.23.0