Avoid random black gaps between bits of content A and B when v2.15.15
authorCarl Hetherington <cth@carlh.net>
Tue, 30 Jul 2019 23:07:06 +0000 (00:07 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 30 Jul 2019 23:07:06 +0000 (00:07 +0100)
content B has had its start trimmed.  In this case when we seek
inaccurately in A we previously also seeked inaccurately in B.
This meant that at the transition the first frame we see of B
may not be the first frame of B.

After this we seek accurately in B so that we definitely get to the
start of it.

This is especially important if the start of B has been trimmed to
within two keyframes so that an inaccurate seek is not sufficient.

src/lib/player.cc

index acde910be24936f7873b03895b59084def5e87d1..bdfa51528deb305c4b72e09b457490012e7f50bb 100644 (file)
@@ -1054,8 +1054,12 @@ Player::seek (DCPTime time, bool accurate)
 
        BOOST_FOREACH (shared_ptr<Piece> i, _pieces) {
                if (time < i->content->position()) {
-                       /* Before; seek to the start of the content */
-                       i->decoder->seek (dcp_to_content_time (i, i->content->position()), accurate);
+                       /* Before; seek to the start of the content.  Even if this request is for an inaccurate seek
+                          we must seek this (following) content accurately, otherwise when we come to the end of the current
+                          content we may not start right at the beginning of the next, causing a gap (if the next content has
+                          been trimmed to a point between keyframes, or something).
+                       */
+                       i->decoder->seek (dcp_to_content_time (i, i->content->position()), true);
                        i->done = false;
                } else if (i->content->position() <= time && time < i->content->end(_film)) {
                        /* During; seek to position */