Ensure FFmpeg doesn't corrupt an early keyframe.

When the analyze func runs, it seems to check between 2-4% (or so?) of the
stream, which for longer videos especially we don't have yet.  Returning a
read failure here seems to truncate that keyframe sometimes.

FFmpeg asks for the total size when this happens, which we were ignoring.
Handling it fixes this, as FFmpeg apparently realizes we ran out of data.
This commit is contained in:
Unknown W. Brackets 2013-06-14 17:56:27 -07:00
parent 34323a1192
commit 2ec8106809

View File

@ -166,6 +166,13 @@ int64_t _MpegSeekbuffer(void *opaque, int64_t offset, int whence)
case SEEK_END:
mpeg->m_decodeNextPos = mpeg->m_streamSize - (u32)offset;
break;
#ifdef USE_FFMPEG
// Don't seek, just return the full size.
// Returning this means FFmpeg won't think frames are truncated if we don't have them yet.
case AVSEEK_SIZE:
return mpeg->m_streamSize;
#endif
}
return offset;
}