Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/evr.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index 957d0e0f797..cc3f828e540 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -528,13 +528,26 @@ static ULONG WINAPI video_stream_get_service_Release(IMFGetService *iface) static HRESULT WINAPI video_stream_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) { struct video_stream *stream = impl_from_stream_IMFGetService(iface); + HRESULT hr = S_OK;
TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
if (IsEqualGUID(service, &MR_VIDEO_ACCELERATION_SERVICE)) { if (IsEqualIID(riid, &IID_IMFVideoSampleAllocator)) - return IMFVideoSampleAllocator_QueryInterface(stream->allocator, riid, obj); + { + EnterCriticalSection(&stream->cs); + + if (!stream->allocator) + hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&stream->allocator); + if (SUCCEEDED(hr)) + hr = IMFVideoSampleAllocator_QueryInterface(stream->allocator, riid, obj); + + LeaveCriticalSection(&stream->cs); + + return hr; + } + return E_NOINTERFACE; }
@@ -569,9 +582,6 @@ static HRESULT video_renderer_stream_create(struct video_renderer *renderer, uns if (FAILED(hr = MFCreateEventQueue(&stream->event_queue))) goto failed;
- if (FAILED(hr = MFCreateVideoSampleAllocator(&IID_IMFVideoSampleAllocator, (void **)&stream->allocator))) - goto failed; - stream->parent = renderer; IMFMediaSink_AddRef(&stream->parent->IMFMediaSink_iface); stream->id = id;