Ensure Seek() waits for any outstanding video/audio frames to be processed in other threads before attempting a seek (and potentially crashing)

This commit is contained in:
Jonathan Thomas
2016-11-23 01:50:03 -06:00
parent 7be1b8ca4c
commit c90ddfd484

View File

@@ -1202,7 +1202,11 @@ void FFmpegReader::Seek(long int requested_frame) throw(TooManySeeks)
requested_frame = info.video_length;
// Debug output
ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::Seek", "requested_frame", requested_frame, "seek_count", seek_count, "last_frame", last_frame, "", -1, "", -1, "", -1);
ZmqLogger::Instance()->AppendDebugMethod("FFmpegReader::Seek", "requested_frame", requested_frame, "seek_count", seek_count, "last_frame", last_frame, "processing_video_frames.size()", processing_video_frames.size(), "processing_audio_frames.size()", processing_audio_frames.size(), "", -1);
// Wait for any processing frames to complete
while (processing_video_frames.size() + processing_audio_frames.size() > 0)
usleep(2500);
// Clear working cache (since we are seeking to another location in the file)
working_cache.Clear();