Commit 9d1f49cd authored by Chris Robinson's avatar Chris Robinson Committed by Alexandre Julliard

quartz: Set the sample time based on the number of bytes read before sending it downstream.

parent b3c4d6ee
......@@ -1045,6 +1045,7 @@ static HRESULT WINAPI FileAsyncReader_Request(IAsyncReader * iface, IMediaSample
static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dwTimeout, IMediaSample ** ppSample, DWORD_PTR * pdwUser)
{
HRESULT hr = S_OK;
DWORD dwBytes = 0;
DATAREQUEST * pDataRq = NULL;
FileAsyncReader *This = impl_from_IAsyncReader(iface);
......@@ -1083,7 +1084,6 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw
if (SUCCEEDED(hr))
{
DWORD dwBytes;
/* get any errors */
if (!GetOverlappedResult(This->hFile, &pDataRq->ovl, &dwBytes, FALSE))
hr = HRESULT_FROM_WIN32(GetLastError());
......@@ -1091,6 +1091,7 @@ static HRESULT WINAPI FileAsyncReader_WaitForNext(IAsyncReader * iface, DWORD dw
if (SUCCEEDED(hr))
{
IMediaSample_SetActualDataLength(pDataRq->pSample, dwBytes);
*ppSample = pDataRq->pSample;
*pdwUser = pDataRq->dwUserData;
}
......
......@@ -1198,6 +1198,7 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
* so that one sample is processed while one sample is fetched. However,
* it is harder to debug so for the moment it will stay as it is */
IMediaSample * pSample = NULL;
REFERENCE_TIME rtSampleStart;
REFERENCE_TIME rtSampleStop;
DWORD_PTR dwUser;
......@@ -1209,10 +1210,11 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
if (SUCCEEDED(hr))
{
rtSampleStop = This->rtCurrent + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(pSample));
rtSampleStart = This->rtCurrent;
rtSampleStop = rtSampleStart + 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, &This->rtCurrent, &rtSampleStop);
hr = IMediaSample_SetTime(pSample, &rtSampleStart, &rtSampleStop);
This->rtCurrent = rtSampleStop;
}
......@@ -1226,6 +1228,14 @@ static void CALLBACK PullPin_Thread_Process(ULONG_PTR iface)
hr = IPin_QueryPinInfo((IPin*)&This->pin, &pinInfo);
if (SUCCEEDED(hr))
{
rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetActualDataLength(pSample));
if (rtSampleStop > This->rtStop)
rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(This->rtStop), allocProps.cbAlign));
hr = IMediaSample_SetTime(pSample, &rtSampleStart, &rtSampleStop);
}
if (SUCCEEDED(hr))
hr = This->fnSampleProc(This->pin.pUserData, pSample);
else
ERR("Processing error: %x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment