[PATCH v5 0/2] MR10306: mfmediaengine: Implement looping behaviour.
When `IMFMediaEngine::SetLoop(TRUE)` is called, media engine will repeatedly loop the video. -- v5: mfmediaengine: Implement looping behaviour. https://gitlab.winehq.org/wine/wine/-/merge_requests/10306
From: Brendan McGrath <bmcgrath@codeweavers.com> When a sink is stopped, all pending requests are discarded by the client (for example IMFMediaSession). --- dlls/mfmediaengine/video_frame_sink.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/mfmediaengine/video_frame_sink.c b/dlls/mfmediaengine/video_frame_sink.c index f710466fed4..301a2bcd03a 100644 --- a/dlls/mfmediaengine/video_frame_sink.c +++ b/dlls/mfmediaengine/video_frame_sink.c @@ -1010,6 +1010,7 @@ static HRESULT video_frame_sink_set_state(struct video_frame_sink *sink, enum si { video_frame_sink_sample_queue_flush(sink); video_frame_sink_set_flag(sink, FLAGS_FIRST_FRAME, FALSE); + sink->sample_request_pending = FALSE; } if (state == SINK_STATE_RUNNING && (sink->state == SINK_STATE_STOPPED || sink->state == SINK_STATE_PAUSED || -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10306
From: Brendan McGrath <bmcgrath@codeweavers.com> --- dlls/mfmediaengine/main.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 2ababd674d7..ac382f8bf60 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -1008,14 +1008,20 @@ static HRESULT WINAPI media_engine_session_events_Invoke(IMFAsyncCallback *iface IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PLAYING, 0, 0); break; case MESessionEnded: - EnterCriticalSection(&engine->cs); - media_engine_set_flag(engine, FLAGS_ENGINE_FIRST_FRAME, FALSE); - media_engine_set_flag(engine, FLAGS_ENGINE_IS_ENDED, TRUE); - engine->video_frame.pts = MINLONGLONG; - LeaveCriticalSection(&engine->cs); - - IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ENDED, 0, 0); + if (engine->flags & FLAGS_ENGINE_LOOP) + { + media_engine_set_current_time(engine, 0.0); + LeaveCriticalSection(&engine->cs); + } + else + { + engine->video_frame.pts = MINLONGLONG; + media_engine_set_flag(engine, FLAGS_ENGINE_FIRST_FRAME, FALSE); + media_engine_set_flag(engine, FLAGS_ENGINE_IS_ENDED, TRUE); + LeaveCriticalSection(&engine->cs); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_ENDED, 0, 0); + } break; case MEEndOfPresentationSegment: -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10306
On Thu Mar 12 18:52:57 2026 +0000, Nikolay Sivov wrote:
There is no queue, it's a user callback. Please leave it the way it was, I believe I tested this manually before. Oh sorry. You are right. For some reason I was thinking it was an EventQueue. I've changed it back to have `LeaveCriticalSection` in both paths.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10306#note_132081
v3: - Call `LeaveCriticalSection` prior to calling user callback. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10306#note_132082
participants (2)
-
Brendan McGrath -
Brendan McGrath (@redmcg)