strmbase: Acquire the streaming lock in sink_EndOfStream().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-01-19 21:35:35 -06:00 committed by Alexandre Julliard
parent 32d339829e
commit 480ece6a15
3 changed files with 13 additions and 14 deletions

View file

@ -465,8 +465,6 @@ static HRESULT dsound_render_sink_eos(struct strmbase_sink *iface)
void *buffer;
DWORD size;
EnterCriticalSection(&filter->filter.stream_cs);
filter->eos = TRUE;
if (graph && SUCCEEDED(IFilterGraph_QueryInterface(graph,
@ -485,7 +483,6 @@ static HRESULT dsound_render_sink_eos(struct strmbase_sink *iface)
memset(buffer, 0, size);
IDirectSoundBuffer_Unlock(filter->dsbuffer, buffer, size, NULL, 0);
LeaveCriticalSection(&filter->filter.stream_cs);
return S_OK;
}

View file

@ -926,21 +926,26 @@ static HRESULT deliver_endofstream(IPin* pin, LPVOID unused)
static HRESULT WINAPI sink_EndOfStream(IPin *iface)
{
struct strmbase_sink *This = impl_sink_from_IPin(iface);
struct strmbase_sink *pin = impl_sink_from_IPin(iface);
HRESULT hr = S_OK;
TRACE("pin %p %s:%s.\n", This, debugstr_w(This->pin.filter->name), debugstr_w(This->pin.name));
TRACE("pin %p %s:%s.\n", pin, debugstr_w(pin->pin.filter->name), debugstr_w(pin->pin.name));
if (This->pFuncsTable->sink_eos)
return This->pFuncsTable->sink_eos(This);
if (pin->pFuncsTable->sink_eos)
{
EnterCriticalSection(&pin->pin.filter->stream_cs);
hr = pin->pFuncsTable->sink_eos(pin);
LeaveCriticalSection(&pin->pin.filter->stream_cs);
return hr;
}
EnterCriticalSection(&This->pin.filter->filter_cs);
if (This->flushing)
EnterCriticalSection(&pin->pin.filter->filter_cs);
if (pin->flushing)
hr = S_FALSE;
LeaveCriticalSection(&This->pin.filter->filter_cs);
LeaveCriticalSection(&pin->pin.filter->filter_cs);
if (hr == S_OK)
hr = SendFurther(This, deliver_endofstream, NULL);
hr = SendFurther(pin, deliver_endofstream, NULL);
return hr;
}

View file

@ -268,8 +268,6 @@ static HRESULT sink_eos(struct strmbase_sink *iface)
IFilterGraph *graph = filter->filter.graph;
IMediaEventSink *event_sink;
EnterCriticalSection(&filter->filter.stream_cs);
filter->eos = TRUE;
if (graph && SUCCEEDED(IFilterGraph_QueryInterface(graph,
@ -282,7 +280,6 @@ static HRESULT sink_eos(struct strmbase_sink *iface)
strmbase_passthrough_eos(&filter->passthrough);
SetEvent(filter->state_event);
LeaveCriticalSection(&filter->filter.stream_cs);
return S_OK;
}