in FFmpegInterop/Source/UncompressedSampleProvider.cpp [88:123]
HRESULT UncompressedSampleProvider::DecodeAVPacket(DataWriter^ dataWriter, AVPacket* avPacket, int64_t& framePts, int64_t& frameDuration)
{
HRESULT hr = S_OK;
bool fGotFrame = false;
AVPacket *pPacket = avPacket;
while (SUCCEEDED(hr))
{
hr = GetFrameFromFFmpegDecoder(pPacket);
pPacket = nullptr;
if (SUCCEEDED(hr))
{
if (hr == S_FALSE)
{
// If the decoder didn't give an initial frame we still need
// to feed it more frames. Keep S_FALSE as the result
if (fGotFrame)
{
hr = S_OK;
}
break;
}
// Update the timestamp if the packet has one
else if (m_pAvFrame->pts != AV_NOPTS_VALUE)
{
framePts = m_pAvFrame->pts;
frameDuration = m_pAvFrame->pkt_duration;
}
fGotFrame = true;
hr = ProcessDecodedFrame(dataWriter);
}
}
return hr;
}