Commit 51dcfe46 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf/samglegrabber: Dump pending items on shutdown.

parent b9ec2719
...@@ -802,11 +802,20 @@ static ULONG WINAPI sample_grabber_sink_AddRef(IMFMediaSink *iface) ...@@ -802,11 +802,20 @@ static ULONG WINAPI sample_grabber_sink_AddRef(IMFMediaSink *iface)
return refcount; return refcount;
} }
static void sample_grabber_release_pending_items(struct sample_grabber *grabber)
{
struct scheduled_item *item, *next_item;
LIST_FOR_EACH_ENTRY_SAFE(item, next_item, &grabber->items, struct scheduled_item, entry)
{
stream_release_pending_item(item);
}
}
static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface) static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface)
{ {
struct sample_grabber *grabber = impl_from_IMFMediaSink(iface); struct sample_grabber *grabber = impl_from_IMFMediaSink(iface);
ULONG refcount = InterlockedDecrement(&grabber->refcount); ULONG refcount = InterlockedDecrement(&grabber->refcount);
struct scheduled_item *item, *next_item;
TRACE("%p, refcount %u.\n", iface, refcount); TRACE("%p, refcount %u.\n", iface, refcount);
...@@ -836,10 +845,7 @@ static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface) ...@@ -836,10 +845,7 @@ static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface)
} }
if (grabber->sample_attributes) if (grabber->sample_attributes)
IMFAttributes_Release(grabber->sample_attributes); IMFAttributes_Release(grabber->sample_attributes);
LIST_FOR_EACH_ENTRY_SAFE(item, next_item, &grabber->items, struct scheduled_item, entry) sample_grabber_release_pending_items(grabber);
{
stream_release_pending_item(item);
}
DeleteCriticalSection(&grabber->cs); DeleteCriticalSection(&grabber->cs);
heap_free(grabber); heap_free(grabber);
} }
...@@ -1031,6 +1037,7 @@ static HRESULT WINAPI sample_grabber_sink_Shutdown(IMFMediaSink *iface) ...@@ -1031,6 +1037,7 @@ static HRESULT WINAPI sample_grabber_sink_Shutdown(IMFMediaSink *iface)
EnterCriticalSection(&grabber->cs); EnterCriticalSection(&grabber->cs);
grabber->is_shut_down = TRUE; grabber->is_shut_down = TRUE;
sample_grabber_release_pending_items(grabber);
if (SUCCEEDED(hr = IMFSampleGrabberSinkCallback_OnShutdown(sample_grabber_get_callback(grabber)))) if (SUCCEEDED(hr = IMFSampleGrabberSinkCallback_OnShutdown(sample_grabber_get_callback(grabber))))
{ {
sample_grabber_set_presentation_clock(grabber, NULL); sample_grabber_set_presentation_clock(grabber, NULL);
......
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