Use round rather than ceil when putting positions and start trims
authorCarl Hetherington <cth@carlh.net>
Tue, 17 Apr 2018 21:04:39 +0000 (22:04 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 17 Apr 2018 21:04:39 +0000 (22:04 +0100)
onto frame boundaries.  ceil() can creep upwards with rounding error,
which I have seen happen over a save/load.

src/lib/video_content.cc

index f78dab17eb3bc495db9e280ef0f54a079b9f5aaf..d3ba6c1ab1f3d50d89806290b8eb8ed12b2b54aa 100644 (file)
@@ -549,13 +549,13 @@ VideoContent::take_settings_from (shared_ptr<const VideoContent> c)
 void
 VideoContent::modify_position (DCPTime& pos) const
 {
-       pos = pos.ceil (_parent->film()->video_frame_rate());
+       pos = pos.round (_parent->film()->video_frame_rate());
 }
 
 void
 VideoContent::modify_trim_start (ContentTime& trim) const
 {
        if (_parent->video_frame_rate()) {
-               trim = trim.ceil (_parent->video_frame_rate().get());
+               trim = trim.round (_parent->video_frame_rate().get());
        }
 }