Nikolay Sivov (@nsivov) commented about dlls/mfmediaengine/video_frame_sink.c:
LONGLONG pts2;
transfer_sample = TRUE;
/* if the second sample we have is also OK, we'll drop the first and use the second */
sample_index_increment(&sample_read_index);
if (sink->sample[sample_read_index] && sample_get_pts(sink->sample[sample_read_index], clocktime, &pts2) == S_OK)
{
*pts = pts2;
IMFSample_Release(sink->sample[sink->sample_read_index]);
sink->sample[sink->sample_read_index] = NULL;
sink->sample_read_index = sample_read_index;
}
}
else if (sink->presentation_sample && !sink->sample_presented)
{
hr = sample_get_pts(sink->presentation_sample, clocktime, pts);
}
I find this hard to understand. We'll need to document what's happening. For example, why does this check one more sample at all? Is that because buffer size is 2, or we always would check the adjacent one.