A couple of fixes to hangs when over-trimming content.
authorCarl Hetherington <cth@carlh.net>
Thu, 5 Jun 2014 22:56:26 +0000 (23:56 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 5 Jun 2014 22:56:26 +0000 (23:56 +0100)
src/lib/content.cc
src/lib/player.cc

index 1ec607d394896b8ec0dbdc7ad1dbeacb7cfb7393..4cdb23e83e0662ec46c5c898df80068cc6d290a3 100644 (file)
@@ -36,6 +36,7 @@ using std::set;
 using std::list;
 using std::cout;
 using std::vector;
+using std::max;
 using boost::shared_ptr;
 using libdcp::raw_convert;
 
@@ -211,7 +212,7 @@ Content::technical_summary () const
 Time
 Content::length_after_trim () const
 {
-       return full_length() - trim_start() - trim_end();
+       return max (0L, full_length() - trim_start() - trim_end());
 }
 
 /** @param t A time relative to the start of this content (not the position).
index 20cea7e4a482bc9da9a4d9b134daf032b8790441..7bf78c905248487e2e9d3723c38d267827e4a11b 100644 (file)
@@ -95,7 +95,7 @@ Player::pass ()
        } type = VIDEO;
 
        for (list<shared_ptr<Piece> >::iterator i = _pieces.begin(); i != _pieces.end(); ++i) {
-               if ((*i)->decoder->done ()) {
+               if ((*i)->decoder->done () || (*i)->content->length_after_trim() == 0) {
                        continue;
                }