Commit 2062dd95 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Block samplegrabber stream event calls after stream is removed.

parent 97f949b9
......@@ -235,6 +235,9 @@ static HRESULT WINAPI sample_grabber_stream_GetEvent(IMFStreamSink *iface, DWORD
TRACE("%p, %#x, %p.\n", iface, flags, event);
if (!stream->sink)
return MF_E_STREAMSINK_REMOVED;
return IMFMediaEventQueue_GetEvent(stream->event_queue, flags, event);
}
......@@ -245,6 +248,9 @@ static HRESULT WINAPI sample_grabber_stream_BeginGetEvent(IMFStreamSink *iface,
TRACE("%p, %p, %p.\n", iface, callback, state);
if (!stream->sink)
return MF_E_STREAMSINK_REMOVED;
return IMFMediaEventQueue_BeginGetEvent(stream->event_queue, callback, state);
}
......@@ -255,6 +261,9 @@ static HRESULT WINAPI sample_grabber_stream_EndGetEvent(IMFStreamSink *iface, IM
TRACE("%p, %p, %p.\n", iface, result, event);
if (!stream->sink)
return MF_E_STREAMSINK_REMOVED;
return IMFMediaEventQueue_EndGetEvent(stream->event_queue, result, event);
}
......@@ -265,6 +274,9 @@ static HRESULT WINAPI sample_grabber_stream_QueueEvent(IMFStreamSink *iface, Med
TRACE("%p, %u, %s, %#x, %p.\n", iface, event_type, debugstr_guid(ext_type), hr, value);
if (!stream->sink)
return MF_E_STREAMSINK_REMOVED;
return IMFMediaEventQueue_QueueEventParamVar(stream->event_queue, event_type, ext_type, hr, value);
}
......@@ -1046,6 +1058,7 @@ static HRESULT WINAPI sample_grabber_sink_Shutdown(IMFMediaSink *iface)
IMFMediaSink_Release(&grabber->stream->sink->IMFMediaSink_iface);
EnterCriticalSection(&grabber->stream->cs);
grabber->stream->sink = NULL;
IMFMediaEventQueue_Shutdown(grabber->stream->event_queue);
LeaveCriticalSection(&grabber->stream->cs);
IMFStreamSink_Release(&grabber->stream->IMFStreamSink_iface);
grabber->stream = NULL;
......
......@@ -2162,7 +2162,6 @@ todo_wine
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFStreamSink_GetEvent(stream, MF_EVENT_FLAG_NO_WAIT, &event);
todo_wine
ok(hr == MF_E_STREAMSINK_REMOVED, "Unexpected hr %#x.\n", hr);
hr = IMFStreamSink_GetMediaSink(stream, &sink2);
......
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