Nikolay Sivov : mfplat: Remove extra critical section from presentation descriptor.

Alexandre Julliard julliard at winehq.org
Fri Mar 6 16:38:42 CST 2020


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Mar  6 18:32:26 2020 +0300

mfplat: Remove extra critical section from presentation descriptor.

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

---

 dlls/mfplat/mediatype.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c
index 382f066327..c52255723c 100644
--- a/dlls/mfplat/mediatype.c
+++ b/dlls/mfplat/mediatype.c
@@ -58,7 +58,6 @@ struct presentation_desc
     IMFPresentationDescriptor IMFPresentationDescriptor_iface;
     struct presentation_desc_entry *descriptors;
     unsigned int count;
-    CRITICAL_SECTION cs;
 };
 
 static HRESULT presentation_descriptor_init(struct presentation_desc *object, DWORD count);
@@ -1239,7 +1238,6 @@ static ULONG WINAPI presentation_descriptor_Release(IMFPresentationDescriptor *i
                 IMFStreamDescriptor_Release(presentation_desc->descriptors[i].descriptor);
         }
         clear_attributes_object(&presentation_desc->attributes);
-        DeleteCriticalSection(&presentation_desc->cs);
         heap_free(presentation_desc->descriptors);
         heap_free(presentation_desc);
     }
@@ -1553,9 +1551,9 @@ static HRESULT WINAPI presentation_descriptor_GetStreamDescriptorByIndex(IMFPres
     if (index >= presentation_desc->count)
         return E_INVALIDARG;
 
-    EnterCriticalSection(&presentation_desc->cs);
+    EnterCriticalSection(&presentation_desc->attributes.cs);
     *selected = presentation_desc->descriptors[index].selected;
-    LeaveCriticalSection(&presentation_desc->cs);
+    LeaveCriticalSection(&presentation_desc->attributes.cs);
 
     *descriptor = presentation_desc->descriptors[index].descriptor;
     IMFStreamDescriptor_AddRef(*descriptor);
@@ -1572,9 +1570,9 @@ static HRESULT WINAPI presentation_descriptor_SelectStream(IMFPresentationDescri
     if (index >= presentation_desc->count)
         return E_INVALIDARG;
 
-    EnterCriticalSection(&presentation_desc->cs);
+    EnterCriticalSection(&presentation_desc->attributes.cs);
     presentation_desc->descriptors[index].selected = TRUE;
-    LeaveCriticalSection(&presentation_desc->cs);
+    LeaveCriticalSection(&presentation_desc->attributes.cs);
 
     return S_OK;
 }
@@ -1588,9 +1586,9 @@ static HRESULT WINAPI presentation_descriptor_DeselectStream(IMFPresentationDesc
     if (index >= presentation_desc->count)
         return E_INVALIDARG;
 
-    EnterCriticalSection(&presentation_desc->cs);
+    EnterCriticalSection(&presentation_desc->attributes.cs);
     presentation_desc->descriptors[index].selected = FALSE;
-    LeaveCriticalSection(&presentation_desc->cs);
+    LeaveCriticalSection(&presentation_desc->attributes.cs);
 
     return S_OK;
 }
@@ -1610,7 +1608,7 @@ static HRESULT WINAPI presentation_descriptor_Clone(IMFPresentationDescriptor *i
 
     presentation_descriptor_init(object, presentation_desc->count);
 
-    EnterCriticalSection(&presentation_desc->cs);
+    EnterCriticalSection(&presentation_desc->attributes.cs);
 
     for (i = 0; i < presentation_desc->count; ++i)
     {
@@ -1620,7 +1618,7 @@ static HRESULT WINAPI presentation_descriptor_Clone(IMFPresentationDescriptor *i
 
     attributes_CopyAllItems(&presentation_desc->attributes, (IMFAttributes *)&object->IMFPresentationDescriptor_iface);
 
-    LeaveCriticalSection(&presentation_desc->cs);
+    LeaveCriticalSection(&presentation_desc->attributes.cs);
 
     *descriptor = &object->IMFPresentationDescriptor_iface;
 
@@ -1677,7 +1675,6 @@ static HRESULT presentation_descriptor_init(struct presentation_desc *object, DW
         return hr;
     object->IMFPresentationDescriptor_iface.lpVtbl = &presentationdescriptorvtbl;
     object->descriptors = heap_alloc_zero(count * sizeof(*object->descriptors));
-    InitializeCriticalSection(&object->cs);
     if (!object->descriptors)
     {
         IMFPresentationDescriptor_Release(&object->IMFPresentationDescriptor_iface);




More information about the wine-cvs mailing list