quartz: Store the current reference time with the PullPin.

This commit is contained in:
Chris Robinson 2007-03-25 15:18:49 -07:00 committed by Alexandre Julliard
parent 57400724b6
commit f5400a2851
2 changed files with 8 additions and 6 deletions

View File

@ -1044,6 +1044,7 @@ HRESULT PullPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID p
pPinImpl->hEventStateChanged = CreateEventW(NULL, FALSE, TRUE, NULL); pPinImpl->hEventStateChanged = CreateEventW(NULL, FALSE, TRUE, NULL);
pPinImpl->rtStart = 0; pPinImpl->rtStart = 0;
pPinImpl->rtCurrent = 0;
pPinImpl->rtStop = ((LONGLONG)0x7fffffff << 32) | 0xffffffff; pPinImpl->rtStop = ((LONGLONG)0x7fffffff << 32) | 0xffffffff;
return S_OK; return S_OK;
@ -1177,7 +1178,6 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
PullPin *This = (PullPin *)iface; PullPin *This = (PullPin *)iface;
HRESULT hr; HRESULT hr;
REFERENCE_TIME rtCurrent;
ALLOCATOR_PROPERTIES allocProps; ALLOCATOR_PROPERTIES allocProps;
PIN_INFO pinInfo; PIN_INFO pinInfo;
@ -1187,11 +1187,12 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
hr = IMemAllocator_GetProperties(This->pAlloc, &allocProps); hr = IMemAllocator_GetProperties(This->pAlloc, &allocProps);
rtCurrent = MEDIATIME_FROM_BYTES(ALIGNDOWN(BYTES_FROM_MEDIATIME(This->rtStart), allocProps.cbAlign)); if (This->rtCurrent < This->rtStart)
This->rtCurrent = MEDIATIME_FROM_BYTES(ALIGNDOWN(BYTES_FROM_MEDIATIME(This->rtStart), allocProps.cbAlign));
TRACE("Start\n"); TRACE("Start\n");
while (rtCurrent < This->rtStop && hr == S_OK) while (This->rtCurrent < This->rtStop && hr == S_OK)
{ {
/* FIXME: to improve performance by quite a bit this should be changed /* FIXME: to improve performance by quite a bit this should be changed
* so that one sample is processed while one sample is fetched. However, * so that one sample is processed while one sample is fetched. However,
@ -1208,11 +1209,11 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
rtSampleStop = rtCurrent + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(pSample)); rtSampleStop = This->rtCurrent + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(pSample));
if (rtSampleStop > This->rtStop) if (rtSampleStop > This->rtStop)
rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(This->rtStop), allocProps.cbAlign)); rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(This->rtStop), allocProps.cbAlign));
hr = IMediaSample_SetTime(pSample, &rtCurrent, &rtSampleStop); hr = IMediaSample_SetTime(pSample, &This->rtCurrent, &rtSampleStop);
rtCurrent = rtSampleStop; This->rtCurrent = rtSampleStop;
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))

View File

@ -84,6 +84,7 @@ typedef struct PullPin
HANDLE hEventStateChanged; HANDLE hEventStateChanged;
REFERENCE_TIME rtStart; REFERENCE_TIME rtStart;
REFERENCE_TIME rtStop; REFERENCE_TIME rtStop;
REFERENCE_TIME rtCurrent;
} PullPin; } PullPin;
/*** Initializers ***/ /*** Initializers ***/