Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/sar.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index 0ea46dcb891..aa0e4eb853c 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -95,6 +95,10 @@ struct audio_renderer IAudioRenderClient *audio_render_client; IAudioStreamVolume *stream_volume; ISimpleAudioVolume *audio_volume; + struct + { + unsigned int flags; + } stream_config; HANDLE buffer_ready_event; MFWORKITEM_KEY buffer_ready_key; unsigned int frame_size; @@ -1170,6 +1174,10 @@ static HRESULT sar_create_mmdevice(IMFAttributes *attributes, struct audio_rende else hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(devenum, eRender, role, &renderer->device);
+ /* Configuration attributes to be used later for audio client initialization. */ + if (attributes) + IMFAttributes_GetUINT32(attributes, &MF_AUDIO_RENDERER_ATTRIBUTE_FLAGS, &renderer->stream_config.flags); + if (FAILED(hr)) hr = MF_E_NO_AUDIO_PLAYBACK_DEVICE;
@@ -1503,6 +1511,7 @@ static HRESULT WINAPI audio_renderer_stream_type_handler_GetMediaTypeByIndex(IMF static HRESULT audio_renderer_create_audio_client(struct audio_renderer *renderer) { IMFAsyncResult *result; + unsigned int flags; WAVEFORMATEX *wfx; HRESULT hr;
@@ -1516,8 +1525,6 @@ static HRESULT audio_renderer_create_audio_client(struct audio_renderer *rendere return hr; }
- /* FIXME: use SAR configuration for flags and session id. */ - /* FIXME: for now always use default format. */ if (FAILED(hr = IAudioClient_GetMixFormat(renderer->audio_client, &wfx))) { @@ -1527,8 +1534,12 @@ static HRESULT audio_renderer_create_audio_client(struct audio_renderer *rendere
renderer->frame_size = wfx->wBitsPerSample * wfx->nChannels / 8;
- hr = IAudioClient_Initialize(renderer->audio_client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, - 1000000, 0, wfx, NULL); + flags = AUDCLNT_STREAMFLAGS_EVENTCALLBACK; + if (renderer->stream_config.flags & MF_AUDIO_RENDERER_ATTRIBUTE_FLAGS_CROSSPROCESS) + flags |= AUDCLNT_STREAMFLAGS_CROSSPROCESS; + if (renderer->stream_config.flags & MF_AUDIO_RENDERER_ATTRIBUTE_FLAGS_NOPERSIST) + flags |= AUDCLNT_STREAMFLAGS_NOPERSIST; + hr = IAudioClient_Initialize(renderer->audio_client, AUDCLNT_SHAREMODE_SHARED, flags, 1000000, 0, wfx, NULL); CoTaskMemFree(wfx); if (FAILED(hr)) {
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/sar.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index aa0e4eb853c..89a517b1358 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -98,6 +98,7 @@ struct audio_renderer struct { unsigned int flags; + GUID session_id; } stream_config; HANDLE buffer_ready_event; MFWORKITEM_KEY buffer_ready_key; @@ -1176,7 +1177,10 @@ static HRESULT sar_create_mmdevice(IMFAttributes *attributes, struct audio_rende
/* Configuration attributes to be used later for audio client initialization. */ if (attributes) + { IMFAttributes_GetUINT32(attributes, &MF_AUDIO_RENDERER_ATTRIBUTE_FLAGS, &renderer->stream_config.flags); + IMFAttributes_GetGUID(attributes, &MF_AUDIO_RENDERER_ATTRIBUTE_SESSION_ID, &renderer->stream_config.session_id); + }
if (FAILED(hr)) hr = MF_E_NO_AUDIO_PLAYBACK_DEVICE; @@ -1539,7 +1543,8 @@ static HRESULT audio_renderer_create_audio_client(struct audio_renderer *rendere flags |= AUDCLNT_STREAMFLAGS_CROSSPROCESS; if (renderer->stream_config.flags & MF_AUDIO_RENDERER_ATTRIBUTE_FLAGS_NOPERSIST) flags |= AUDCLNT_STREAMFLAGS_NOPERSIST; - hr = IAudioClient_Initialize(renderer->audio_client, AUDCLNT_SHAREMODE_SHARED, flags, 1000000, 0, wfx, NULL); + hr = IAudioClient_Initialize(renderer->audio_client, AUDCLNT_SHAREMODE_SHARED, flags, 1000000, 0, wfx, + &renderer->stream_config.session_id); CoTaskMemFree(wfx); if (FAILED(hr)) {