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 <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5b406e1446
commit
b3e325f36b
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue