Commit 882d8229 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/samplegrabber: Check shutdown state when setting the clock.

parent c45ae2c6
......@@ -1054,7 +1054,11 @@ static HRESULT WINAPI sample_grabber_sink_SetPresentationClock(IMFMediaSink *ifa
EnterCriticalSection(&grabber->cs);
if (SUCCEEDED(hr = IMFSampleGrabberSinkCallback_OnSetPresentationClock(sample_grabber_get_callback(grabber),
if (grabber->is_shut_down)
{
hr = MF_E_SHUTDOWN;
}
else if (SUCCEEDED(hr = IMFSampleGrabberSinkCallback_OnSetPresentationClock(sample_grabber_get_callback(grabber),
clock)))
{
sample_grabber_set_presentation_clock(grabber, clock);
......
......@@ -4649,9 +4649,16 @@ static void test_sample_grabber(void)
EXPECT_REF(clock, 3);
hr = IMFMediaSink_Shutdown(sink);
ok(hr == S_OK, "Failed to shut down, hr %#lx.\n", hr);
EXPECT_REF(clock, 1);
hr = IMFMediaSink_SetPresentationClock(sink, NULL);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaSink_SetPresentationClock(sink, clock);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);
ref = IMFPresentationClock_Release(clock);
ok(ref == 0, "Release returned %ld\n", ref);
ok(!ref, "Unexpected refcount %ld.\n", ref);
hr = IMFMediaEventGenerator_GetEvent(eg, MF_EVENT_FLAG_NO_WAIT, &event);
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#lx.\n", hr);
......@@ -4730,9 +4737,9 @@ static void test_sample_grabber(void)
IMFStreamSink_Release(stream);
ref = IMFActivate_Release(activate);
ok(ref == 0, "Release returned %ld\n", ref);
ok(!ref, "Unexpected refcount %ld.\n", ref);
ref = IMFMediaSink_Release(sink);
ok(ref == 0, "Release returned %ld\n", ref);
ok(!ref, "Unexpected refcount %ld.\n", ref);
/* Rateless mode with MF_SAMPLEGRABBERSINK_IGNORE_CLOCK. */
hr = MFCreateMediaType(&media_type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment