From: Conor McCarthy cmccarthy@codeweavers.com
Calling MFScheduleWorkItemEx() schedules the operation in the timer queue, but callback invocation occurs in the standard queue. Execution of app callbacks in a dedicated thread prevents possible slow execution from competing with demuxing and decoding. This matches native Windows behaviour. --- dlls/mf/clock.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/mf/clock.c b/dlls/mf/clock.c index e6be05d2794..1fd6b3028a0 100644 --- a/dlls/mf/clock.c +++ b/dlls/mf/clock.c @@ -1054,9 +1054,24 @@ static ULONG WINAPI present_clock_sink_callback_Release(IMFAsyncCallback *iface) return IMFPresentationClock_Release(&clock->IMFPresentationClock_iface); }
+static DWORD mf_get_sink_queue_id(void) +{ + static SRWLOCK mf_sink_queue_srw = SRWLOCK_INIT; + static DWORD mf_sink_queue_id; + + AcquireSRWLockExclusive(&mf_sink_queue_srw); + if (!mf_sink_queue_id) + MFAllocateWorkQueue(&mf_sink_queue_id); + ReleaseSRWLockExclusive(&mf_sink_queue_srw); + + return mf_sink_queue_id ? mf_sink_queue_id : MFASYNC_CALLBACK_QUEUE_STANDARD; +} + static HRESULT WINAPI present_clock_callback_GetParameters(IMFAsyncCallback *iface, DWORD *flags, DWORD *queue) { - return E_NOTIMPL; + *flags = 0; + *queue = mf_get_sink_queue_id(); + return S_OK; }
static HRESULT WINAPI present_clock_sink_callback_Invoke(IMFAsyncCallback *iface, IMFAsyncResult *result)