Try to fix strange behaviour of the preview slider towards the end
authorCarl Hetherington <cth@carlh.net>
Mon, 1 Apr 2019 23:58:53 +0000 (00:58 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 1 Apr 2019 23:58:53 +0000 (00:58 +0100)
of content where there is a section at the end with no keyframe (#1522).

src/wx/controls.cc

index 3e06664607d8617a158af7fbe74780b3ebb84774..473ad8cb343e40ab1413f570dfdf3df8172b0185 100644 (file)
@@ -208,11 +208,15 @@ Controls::slider_moved (bool page)
 
        DCPTime t (_slider->GetValue() * _film->length().get() / 4096);
        t = t.round (_film->video_frame_rate());
-       /* Ensure that we hit the end of the film at the end of the slider */
+       /* Ensure that we hit the end of the film at the end of the slider.  In particular, we
+          need to do an accurate seek in case there isn't a keyframe near the end.
+       */
+       bool accurate = false;
        if (t >= _film->length ()) {
                t = _film->length() - _viewer->one_video_frame();
+               accurate = true;
        }
-       _viewer->seek (t, false);
+       _viewer->seek (t, accurate);
        update_position_label ();
 
        log (