Revert "quartz: Handle failures better in acmwrapper.".
This reverts commit 1ba8ece76e
.
Code for holding sample doesn't make sense and shouldn't be there
because it should really be handled by keeping track of the last
successful position of a frame sent and aborting the whole processing
as soon as rejection occurs.
This commit is contained in:
parent
edacd984ef
commit
4afc2ae951
|
@ -48,9 +48,6 @@ typedef struct ACMWrapperImpl
|
||||||
LPWAVEFORMATEX pWfIn;
|
LPWAVEFORMATEX pWfIn;
|
||||||
LPWAVEFORMATEX pWfOut;
|
LPWAVEFORMATEX pWfOut;
|
||||||
|
|
||||||
IMediaSample *recv, *xmit;
|
|
||||||
ULONG done;
|
|
||||||
|
|
||||||
LONGLONG lasttime_real;
|
LONGLONG lasttime_real;
|
||||||
LONGLONG lasttime_sent;
|
LONGLONG lasttime_sent;
|
||||||
} ACMWrapperImpl;
|
} ACMWrapperImpl;
|
||||||
|
@ -69,39 +66,17 @@ static HRESULT ACMWrapper_ProcessSampleData(TransformFilterImpl* pTransformFilte
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
LONGLONG tStart = -1, tStop = -1, tMed;
|
LONGLONG tStart = -1, tStop = -1, tMed;
|
||||||
|
|
||||||
assert(pSample);
|
|
||||||
|
|
||||||
if (This->xmit)
|
|
||||||
{
|
|
||||||
hr = OutputPin_SendSample((OutputPin*)This->tf.ppPins[1], This->xmit);
|
|
||||||
if (hr != S_OK)
|
|
||||||
return hr;
|
|
||||||
IMediaSample_Release(This->xmit);
|
|
||||||
This->xmit = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("Cannot get pointer to sample data (%x)\n", hr);
|
ERR("Cannot get pointer to sample data (%x)\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
cbSrcStream = IMediaSample_GetActualDataLength(pSample);
|
|
||||||
preroll = (IMediaSample_IsPreroll(pSample) == S_OK);
|
preroll = (IMediaSample_IsPreroll(pSample) == S_OK);
|
||||||
|
|
||||||
if (pSample != This->recv)
|
|
||||||
{
|
|
||||||
if (This->recv)
|
|
||||||
{
|
|
||||||
/* Get rid of buffered sample first */
|
|
||||||
hr = ACMWrapper_ProcessSampleData(pTransformFilter, This->recv);
|
|
||||||
if (hr != S_OK)
|
|
||||||
return hr;
|
|
||||||
if (This->recv)
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
IMediaSample_GetTime(pSample, &tStart, &tStop);
|
IMediaSample_GetTime(pSample, &tStart, &tStop);
|
||||||
|
cbSrcStream = IMediaSample_GetActualDataLength(pSample);
|
||||||
|
|
||||||
/* Prevent discontinuities when codecs 'absorb' data but not give anything back in return */
|
/* Prevent discontinuities when codecs 'absorb' data but not give anything back in return */
|
||||||
if (IMediaSample_IsDiscontinuity(pSample) == S_OK)
|
if (IMediaSample_IsDiscontinuity(pSample) == S_OK)
|
||||||
|
@ -113,17 +88,10 @@ static HRESULT ACMWrapper_ProcessSampleData(TransformFilterImpl* pTransformFilte
|
||||||
tStart = This->lasttime_sent;
|
tStart = This->lasttime_sent;
|
||||||
else
|
else
|
||||||
WARN("Discontinuity\n");
|
WARN("Discontinuity\n");
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tStart = This->lasttime_sent;
|
|
||||||
tStop = This->lasttime_real;
|
|
||||||
cbSrcStream -= This->done;
|
|
||||||
pbSrcStream += This->done;
|
|
||||||
}
|
|
||||||
tMed = tStart;
|
tMed = tStart;
|
||||||
|
|
||||||
TRACE("Sample data ptr = %p, size = %u\n", pbSrcStream, cbSrcStream);
|
TRACE("Sample data ptr = %p, size = %ld\n", pbSrcStream, (long)cbSrcStream);
|
||||||
|
|
||||||
hr = IPin_ConnectionMediaType(This->tf.ppPins[0], &amt);
|
hr = IPin_ConnectionMediaType(This->tf.ppPins[0], &amt);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
|
@ -233,44 +201,17 @@ error:
|
||||||
ash.pbSrc += ash.cbSrcLengthUsed;
|
ash.pbSrc += ash.cbSrcLengthUsed;
|
||||||
ash.cbSrcLength -= ash.cbSrcLengthUsed;
|
ash.cbSrcLength -= ash.cbSrcLengthUsed;
|
||||||
|
|
||||||
if (hr == S_FALSE)
|
|
||||||
{
|
|
||||||
This->xmit = pOutSample;
|
|
||||||
if (ash.cbSrcLength && !This->recv)
|
|
||||||
{
|
|
||||||
This->recv = pSample;
|
|
||||||
IMediaSample_AddRef(This->recv);
|
|
||||||
}
|
|
||||||
else if (This->recv)
|
|
||||||
{
|
|
||||||
IMediaSample_Release(This->recv);
|
|
||||||
This->recv = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
This->done = IMediaSample_GetActualDataLength(pSample) - ash.cbSrcLength;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pOutSample)
|
if (pOutSample)
|
||||||
IMediaSample_Release(pOutSample);
|
IMediaSample_Release(pOutSample);
|
||||||
pOutSample = NULL;
|
pOutSample = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
This->lasttime_real = tStop;
|
This->lasttime_real = tStop;
|
||||||
This->lasttime_sent = tMed;
|
This->lasttime_sent = tMed;
|
||||||
|
|
||||||
|
|
||||||
if (hr != S_OK)
|
if (hr != S_OK)
|
||||||
FIXME("FATALITY: %08x\n", hr);
|
FIXME("FATALITY: %08x\n", hr);
|
||||||
else if (This->recv)
|
|
||||||
{
|
|
||||||
assert(This->recv == pSample);
|
|
||||||
IMediaSample_Release(This->recv);
|
|
||||||
This->recv = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hr == S_FALSE)
|
|
||||||
return S_OK;
|
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
@ -336,13 +277,7 @@ static HRESULT ACMWrapper_Cleanup(TransformFilterImpl* pTransformFilter)
|
||||||
|
|
||||||
This->has = 0;
|
This->has = 0;
|
||||||
This->lasttime_real = This->lasttime_sent = -1;
|
This->lasttime_real = This->lasttime_sent = -1;
|
||||||
if (This->recv)
|
|
||||||
IMediaSample_Release(This->recv);
|
|
||||||
|
|
||||||
if (This->xmit)
|
|
||||||
IMediaSample_Release(This->xmit);
|
|
||||||
|
|
||||||
This->recv = This->xmit = NULL;
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +313,6 @@ HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
||||||
|
|
||||||
*ppv = (LPVOID)This;
|
*ppv = (LPVOID)This;
|
||||||
This->lasttime_real = This->lasttime_sent = -1;
|
This->lasttime_real = This->lasttime_sent = -1;
|
||||||
This->recv = This->xmit = NULL;
|
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue