From f5400a28519a0d64e6f97464ec4596d1c8555b86 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 25 Mar 2007 15:18:49 -0700 Subject: [PATCH] quartz: Store the current reference time with the PullPin. --- dlls/quartz/pin.c | 13 +++++++------ dlls/quartz/pin.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/quartz/pin.c b/dlls/quartz/pin.c index b3aa0427044..58e5beeec89 100644 --- a/dlls/quartz/pin.c +++ b/dlls/quartz/pin.c @@ -1044,6 +1044,7 @@ HRESULT PullPin_Init(const PIN_INFO * pPinInfo, SAMPLEPROC pSampleProc, LPVOID p pPinImpl->hEventStateChanged = CreateEventW(NULL, FALSE, TRUE, NULL); pPinImpl->rtStart = 0; + pPinImpl->rtCurrent = 0; pPinImpl->rtStop = ((LONGLONG)0x7fffffff << 32) | 0xffffffff; return S_OK; @@ -1177,7 +1178,6 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface) PullPin *This = (PullPin *)iface; HRESULT hr; - REFERENCE_TIME rtCurrent; ALLOCATOR_PROPERTIES allocProps; PIN_INFO pinInfo; @@ -1187,11 +1187,12 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface) 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"); - 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 * 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)) { - rtSampleStop = rtCurrent + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(pSample)); + rtSampleStop = This->rtCurrent + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(pSample)); if (rtSampleStop > This->rtStop) rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(This->rtStop), allocProps.cbAlign)); - hr = IMediaSample_SetTime(pSample, &rtCurrent, &rtSampleStop); - rtCurrent = rtSampleStop; + hr = IMediaSample_SetTime(pSample, &This->rtCurrent, &rtSampleStop); + This->rtCurrent = rtSampleStop; } if (SUCCEEDED(hr)) diff --git a/dlls/quartz/pin.h b/dlls/quartz/pin.h index bb48df3596b..02830cc6a53 100644 --- a/dlls/quartz/pin.h +++ b/dlls/quartz/pin.h @@ -84,6 +84,7 @@ typedef struct PullPin HANDLE hEventStateChanged; REFERENCE_TIME rtStart; REFERENCE_TIME rtStop; + REFERENCE_TIME rtCurrent; } PullPin; /*** Initializers ***/