[PATCH 1/4] quartz/memallocator: Forbid setting the start media time without setting the end time.

Zebediah Figura z.figura12 at gmail.com
Mon Jun 24 20:05:16 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/quartz/memallocator.c       | 21 ++++++++++-----------
 dlls/quartz/tests/memallocator.c |  2 +-
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
index ac12abd6e58..1d74c3cb9fe 100644
--- a/dlls/quartz/memallocator.c
+++ b/dlls/quartz/memallocator.c
@@ -734,21 +734,20 @@ static HRESULT WINAPI StdMediaSample2_GetMediaTime(IMediaSample2 * iface, LONGLO
     return S_OK;
 }
 
-static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 * iface, LONGLONG * pStart, LONGLONG * pEnd)
+static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLONG *start, LONGLONG *end)
 {
-    StdMediaSample2 *This = impl_from_IMediaSample2(iface);
-
-    TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd);
+    StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
 
-    if (pStart)
-        This->tMediaStart = *pStart;
-    else
-        This->tMediaStart = INVALID_MEDIA_TIME;
+    TRACE("sample %p, start %p, end %p.\n", iface, start, end);
 
-    if (pEnd)
-        This->tMediaEnd = *pEnd;
+    if (start)
+    {
+        if (!end) return E_POINTER;
+        sample->tMediaStart = *start;
+        sample->tMediaEnd = *end;
+    }
     else
-        This->tMediaEnd = 0;
+        sample->tMediaStart = INVALID_MEDIA_TIME;
 
     return S_OK;
 }
diff --git a/dlls/quartz/tests/memallocator.c b/dlls/quartz/tests/memallocator.c
index b4f3b23710e..3868312aac9 100644
--- a/dlls/quartz/tests/memallocator.c
+++ b/dlls/quartz/tests/memallocator.c
@@ -379,7 +379,7 @@ static void test_media_time(void)
     {
         start = 0x123;
         hr = IMediaSample_SetMediaTime(sample, &start, NULL);
-        todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr);
+        ok(hr == E_POINTER, "Got hr %#x.\n", hr);
     }
 
     end = 0x321;
-- 
2.22.0




More information about the wine-devel mailing list