Commit 30da0c12 authored by Sébastien Gonzalve's avatar Sébastien Gonzalve Committed by Arjan Spieard

Make video thread wait when EOF is reached

Actually, the video may end long before audio, and the video thread must
remain available to any seek request.
parent 9825e344
......@@ -66,14 +66,17 @@ Video::Video(fs::path const& _videoFile, double videoGap): m_videoGap(videoGap),
try {
ffmpeg->handleOneFrame();
errors = 0;
l.lock();
} catch (FFmpeg::Eof&) {
push(Bitmap());
std::clog << "ffmpeg/debug: done loading " << file << std::endl;
l.lock();
m_cond.wait(l, [this]{ return m_quit || m_seek_asked; });
} catch (std::exception& e) {
std::clog << "ffmpeg/error: " << file << ": " << e.what() << std::endl;
if (++errors > 2) { std::clog << "ffmpeg/error: FFMPEG terminating due to multiple errors" << std::endl; break; }
l.lock();
}
l.lock();
}
});
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment