From 44318feeb659588175958101b7551d046c9773a5 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 24 Jun 2019 20:05:16 -0500 Subject: [PATCH] quartz/memallocator: Forbid setting the start media time without setting the end time. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- 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); + StdMediaSample2 *sample = impl_from_IMediaSample2(iface); - TRACE("(%p)->(%p, %p)\n", iface, pStart, pEnd); + TRACE("sample %p, start %p, end %p.\n", iface, start, end); - if (pStart) - This->tMediaStart = *pStart; + if (start) + { + if (!end) return E_POINTER; + sample->tMediaStart = *start; + sample->tMediaEnd = *end; + } else - This->tMediaStart = INVALID_MEDIA_TIME; - - if (pEnd) - This->tMediaEnd = *pEnd; - 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;