diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-11-09 16:52:56 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-11-09 16:52:56 +0000 |
| commit | 3417219e1434ff38df90fe0ddf86c58c43f08ec3 (patch) | |
| tree | 2ce053ece55a548b2a766b57dbeb41aef937555a /src/lib | |
| parent | 153e1cb890fd6b9ac4a01cd51858dee8d8e64f68 (diff) | |
Stop strange things happening with zero-length video files.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ffmpeg_examiner.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc index ceeaee112..fa0f54b23 100644 --- a/src/lib/ffmpeg_examiner.cc +++ b/src/lib/ffmpeg_examiner.cc @@ -26,6 +26,7 @@ extern "C" { using std::string; using std::cout; +using std::max; using std::stringstream; using boost::shared_ptr; using boost::optional; @@ -135,7 +136,8 @@ FFmpegExaminer::video_size () const VideoContent::Frame FFmpegExaminer::video_length () const { - return (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate(); + VideoContent::Frame const length = (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate(); + return max (0, length); } string |
