Nikolay Sivov : mf/evr: Create sample allocators on demand.

Alexandre Julliard julliard at winehq.org
Thu Oct 22 15:27:31 CDT 2020


Module: wine
Branch: master
Commit: b8d10aa46c123f0c35729e8982e8976c77dc5536
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b8d10aa46c123f0c35729e8982e8976c77dc5536

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Oct 22 14:29:03 2020 +0300

mf/evr: Create sample allocators on demand.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;




More information about the wine-cvs mailing list