I've had a similar problem in playback of H.264 movies on Mac OS X.
AVPlayerItemVideoOutput reports YES that it hasNewPixelBufferForItemTime,
but then it delivers the wrong frame anyway.
I have yet to discover a good solution, because many workarounds break scrubbing of the playhead.
AVPlayerItemVideoOutput *video_output;
if(video_output && ([video_output hasNewPixelBufferForItemTime:tph]))
{
CMTime it, ht; /
CVPixelBufferRef pix = [video_output copyPixelBufferForItemTime:tph itemTimeForDisplay:&it];
// kpk 02/01/2018 prevent wrong inFrame from being displayed.
// dang... unfortunately this breaks scrubbing for highly compressed movies (that have less key frames?)
double receivedTime = (((double)it.value) / tph.timescale);
double actualDiff = fabs(receivedTime - phTime );
if ( seeking && (actualDiff > 0.2 || (actualDiff > 0.1 && it.value == 0.0)))
{
if ( seekToInFrame )
{
if(verbose) printf( "discarding mismatched frame time %0.2f vs %0.2f, %s\n", phTime, receivedTime, threadName );
seekToInFrame = NO; /
return;
}
if(verbose) printf( "mismatched frame time %0.2f vs %0.2f, %s\n", phTime, receivedTime, threadName );
}