in FFmpegInterop/Source/MediaSampleProvider.cpp [110:130]
HRESULT MediaSampleProvider::DecodeAVPacket(DataWriter^ dataWriter, AVPacket *avPacket, int64_t &framePts, int64_t &frameDuration)
{
// For the simple case of compressed samples, each packet is a sample
if (avPacket != nullptr)
{
frameDuration = avPacket->duration;
if (avPacket->pts != AV_NOPTS_VALUE)
{
framePts = avPacket->pts;
// Set the PTS for the next sample if it doesn't one.
m_nextFramePts = framePts + frameDuration;
}
else
{
framePts = m_nextFramePts;
// Set the PTS for the next sample if it doesn't one.
m_nextFramePts += frameDuration;
}
}
return S_OK;
}