Fix progress reporting.
authorCarl Hetherington <cth@carlh.net>
Thu, 20 Mar 2025 00:25:58 +0000 (01:25 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 22 Mar 2025 12:29:59 +0000 (13:29 +0100)
earliest_time will be empty when we're at the end of the film, not the
beginning.

src/lib/player.cc

index 45b6051c76c01f57165593174b0e1b091de3b8ff..869067906e4989cf74d9c00c2ebc10676c1e1517 100644 (file)
@@ -1662,7 +1662,7 @@ Player::frames_done() const
        optional<DCPTime> earliest_time;
        std::tie(earliest_content, earliest_time) = earliest_piece_and_time();
 
-       return earliest_time.get_value_or({}).frames_round(film->video_frame_rate());
+       return earliest_time.get_value_or(film->length()).frames_round(film->video_frame_rate());
 }
 
 
@@ -1676,5 +1676,5 @@ Player::progress() const
        optional<DCPTime> earliest_time;
        std::tie(earliest_content, earliest_time) = earliest_piece_and_time();
 
-       return static_cast<float>(earliest_time.get_value_or({}).get()) / film->length().get();
+       return static_cast<float>(earliest_time.get_value_or(film->length()).get()) / film->length().get();
 }