From: Brendan McGrath <bmcgrath@codeweavers.com> --- dlls/mf/sar.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index 19e4eeda6b7..c1b00d7c9d8 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -30,13 +30,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat); -enum stream_state -{ - STREAM_STATE_STOPPED = 0, - STREAM_STATE_RUNNING, - STREAM_STATE_PAUSED, -}; - enum audio_renderer_flags { SAR_SHUT_DOWN = 0x1, @@ -104,9 +97,10 @@ struct audio_renderer unsigned int queued_frames; unsigned int max_frames; struct list queue; - enum stream_state state; unsigned int flags; CRITICAL_SECTION cs; + + MFCLOCK_STATE clock_state; }; static void release_pending_object(struct queued_object *object) @@ -636,11 +630,11 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockStart(IMFClockStateSink * EnterCriticalSection(&renderer->cs); if (renderer->audio_client) { - if (renderer->state != STREAM_STATE_RUNNING) + if (renderer->clock_state != MFCLOCK_STATE_RUNNING) { if (FAILED(hr = IAudioClient_Start(renderer->audio_client))) WARN("Failed to start audio client, hr %#lx.\n", hr); - renderer->state = STREAM_STATE_RUNNING; + renderer->clock_state = MFCLOCK_STATE_RUNNING; } } else @@ -664,7 +658,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockStop(IMFClockStateSink *i EnterCriticalSection(&renderer->cs); if (renderer->audio_client) { - if (renderer->state != STREAM_STATE_STOPPED) + if (renderer->clock_state != MFCLOCK_STATE_STOPPED) { if (SUCCEEDED(hr = IAudioClient_Stop(renderer->audio_client))) { @@ -673,7 +667,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockStop(IMFClockStateSink *i } else WARN("Failed to stop audio client, hr %#lx.\n", hr); - renderer->state = STREAM_STATE_STOPPED; + renderer->clock_state = MFCLOCK_STATE_STOPPED; renderer->flags &= ~SAR_PREROLLED; } } @@ -694,13 +688,13 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockPause(IMFClockStateSink * TRACE("%p, %s.\n", iface, debugstr_time(systime)); EnterCriticalSection(&renderer->cs); - if (renderer->state == STREAM_STATE_RUNNING) + if (renderer->clock_state == MFCLOCK_STATE_RUNNING) { if (renderer->audio_client) { if (FAILED(hr = IAudioClient_Stop(renderer->audio_client))) WARN("Failed to stop audio client, hr %#lx.\n", hr); - renderer->state = STREAM_STATE_PAUSED; + renderer->clock_state = MFCLOCK_STATE_PAUSED; } else hr = MF_E_NOT_INITIALIZED; @@ -725,11 +719,11 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockRestart(IMFClockStateSink EnterCriticalSection(&renderer->cs); if (renderer->audio_client) { - if ((preroll = (renderer->state != STREAM_STATE_RUNNING))) + if ((preroll = (renderer->clock_state != MFCLOCK_STATE_RUNNING))) { if (FAILED(hr = IAudioClient_Start(renderer->audio_client))) WARN("Failed to start audio client, hr %#lx.\n", hr); - renderer->state = STREAM_STATE_RUNNING; + renderer->clock_state = MFCLOCK_STATE_RUNNING; } } else @@ -1375,11 +1369,11 @@ static HRESULT WINAPI audio_renderer_stream_ProcessSample(IMFStreamSink *iface, hr = MF_E_STREAMSINK_REMOVED; else { - if (renderer->state == STREAM_STATE_RUNNING) + if (renderer->clock_state == MFCLOCK_STATE_RUNNING) hr = stream_queue_sample(renderer, sample); renderer->flags &= ~SAR_SAMPLE_REQUESTED; - if (renderer->queued_frames < renderer->max_frames && renderer->state == STREAM_STATE_RUNNING) + if (renderer->queued_frames < renderer->max_frames && renderer->clock_state == MFCLOCK_STATE_RUNNING) { IMFMediaEventQueue_QueueEventParamVar(renderer->stream_event_queue, MEStreamSinkRequestSample, &GUID_NULL, S_OK, NULL); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10126