From b3e325f36b2a5d78c18021790c69b70fb02b418b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 4 Oct 2019 10:02:45 -0500 Subject: [PATCH] strmbase: Move tracking of the stream start time to the renderer. Only renderers should ever need to care about this. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/dsoundrender.c | 6 +++--- dlls/strmbase/renderer.c | 10 +++++----- dlls/strmbase/transform.c | 3 --- dlls/winegstreamer/gstdemux.c | 5 ----- dlls/wineqtdecoder/qtsplitter.c | 1 - include/wine/strmbase.h | 2 +- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index b6eb7ba2587..d3c382f1663 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -158,10 +158,10 @@ static HRESULT DSoundRender_GetWritePos(DSoundRenderImpl *This, DWORD *ret_write if (This->renderer.filter.pClock == &This->IReferenceClock_iface) { max_lag = min_lag; cur = This->play_time + time_from_pos(This, playpos); - cur -= This->renderer.filter.rtStreamStart; + cur -= This->renderer.stream_start; } else if (This->renderer.filter.pClock) { IReferenceClock_GetTime(This->renderer.filter.pClock, &cur); - cur -= This->renderer.filter.rtStreamStart; + cur -= This->renderer.stream_start; } else write_at = -1; @@ -384,7 +384,7 @@ static HRESULT WINAPI DSoundRender_DoRenderSample(BaseRenderer *iface, IMediaSam REFERENCE_TIME jitter, now = 0; Quality q; IReferenceClock_GetTime(This->renderer.filter.pClock, &now); - jitter = now - This->renderer.filter.rtStreamStart - tStart; + jitter = now - This->renderer.stream_start - tStart; if (jitter <= -DSoundRenderer_Max_Fill) jitter += DSoundRenderer_Max_Fill; else if (jitter < 0) diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 25534154e95..7d8420e73c1 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -363,11 +363,11 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp IReferenceClock_GetTime(This->filter.pClock, &now); - if (now - This->filter.rtStreamStart - start <= -10000) + if (now - This->stream_start - start <= -10000) { HANDLE handles[2] = {This->advise_event, This->flush_event}; - IReferenceClock_AdviseTime(This->filter.pClock, This->filter.rtStreamStart, + IReferenceClock_AdviseTime(This->filter.pClock, This->stream_start, start, (HEVENT)This->advise_event, &cookie); LeaveCriticalSection(&This->csRenderLock); @@ -429,7 +429,7 @@ HRESULT WINAPI BaseRendererImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart) TRACE("(%p)->(%s)\n", This, wine_dbgstr_longlong(tStart)); EnterCriticalSection(&This->csRenderLock); - This->filter.rtStreamStart = tStart; + This->stream_start = tStart; if (This->filter.state == State_Running) goto out; @@ -440,7 +440,7 @@ HRESULT WINAPI BaseRendererImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart) This->sink.end_of_stream = FALSE; } - QualityControlRender_Start(This->qcimpl, This->filter.rtStreamStart); + QualityControlRender_Start(This->qcimpl, This->stream_start); if (This->sink.pin.peer && This->pFuncsTable->renderer_start_stream) This->pFuncsTable->renderer_start_stream(This); if (This->filter.state == State_Stopped) @@ -547,7 +547,7 @@ HRESULT WINAPI BaseRendererImpl_BeginFlush(BaseRenderer* iface) HRESULT WINAPI BaseRendererImpl_EndFlush(BaseRenderer* iface) { TRACE("(%p)\n", iface); - QualityControlRender_Start(iface->qcimpl, iface->filter.rtStreamStart); + QualityControlRender_Start(iface->qcimpl, iface->stream_start); RendererPosPassThru_ResetMediaTime(iface->pPosition); ResetEvent(iface->flush_event); return S_OK; diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index 77de1227dd9..abf5ed34b3c 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -268,10 +268,7 @@ static HRESULT WINAPI TransformFilterImpl_Run(IBaseFilter *iface, REFERENCE_TIME } if (SUCCEEDED(hr)) - { - This->filter.rtStreamStart = tStart; This->filter.state = State_Running; - } } LeaveCriticalSection(&This->csReceive); diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 66b7114c520..4a685b1bd5a 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1406,10 +1406,6 @@ static HRESULT WINAPI GST_Run(IBaseFilter *iface, REFERENCE_TIME tStart) if (!This->container) return VFW_E_NOT_CONNECTED; - EnterCriticalSection(&This->filter.csFilter); - This->filter.rtStreamStart = tStart; - LeaveCriticalSection(&This->filter.csFilter); - gst_element_get_state(This->container, &now, NULL, -1); if (now == GST_STATE_PLAYING) return S_OK; @@ -1423,7 +1419,6 @@ static HRESULT WINAPI GST_Run(IBaseFilter *iface, REFERENCE_TIME tStart) EnterCriticalSection(&This->filter.csFilter); gst_element_set_state(This->container, GST_STATE_PLAYING); - This->filter.rtStreamStart = tStart; for (i = 0; i < This->cStreams; i++) { hr = BaseOutputPinImpl_Active(&This->ppPins[i]->pin); diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c index 218ed5dad70..99539e5c895 100644 --- a/dlls/wineqtdecoder/qtsplitter.c +++ b/dlls/wineqtdecoder/qtsplitter.c @@ -753,7 +753,6 @@ static HRESULT WINAPI QT_Run(IBaseFilter *iface, REFERENCE_TIME tStart) TRACE("(%s)\n", wine_dbgstr_longlong(tStart)); EnterCriticalSection(&This->csReceive); - This->filter.rtStreamStart = tStart; if (This->pVideo_Pin) hr = BaseOutputPinImpl_Active(&This->pVideo_Pin->pin); diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 5eaf204f471..99d680a365b 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -155,7 +155,6 @@ struct strmbase_filter CRITICAL_SECTION csFilter; FILTER_STATE state; - REFERENCE_TIME rtStreamStart; IReferenceClock * pClock; FILTER_INFO filterInfo; CLSID clsid; @@ -538,6 +537,7 @@ typedef struct BaseRendererTag * to immediately unblock the streaming thread. */ HANDLE flush_event; IMediaSample *pMediaSample; + REFERENCE_TIME stream_start; IQualityControl *pQSink; struct QualityControlImpl *qcimpl;