Fix sequencing failure in some very specific circumstances.
authorCarl Hetherington <cth@carlh.net>
Wed, 31 Jan 2018 00:25:06 +0000 (00:25 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 31 Jan 2018 00:25:06 +0000 (00:25 +0000)
src/lib/player.cc
src/lib/player_video.cc
src/lib/player_video.h

index 3d57627407d4dbdafdf24731aa0df0629b986fa6..9ee8ab72c986c34370b0822aaea6a2501282f220 100644 (file)
@@ -715,8 +715,9 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                        }
                        while (j < time || eyes != video.eyes) {
                                if (last != _last_video.end()) {
-                                       last->second->set_eyes (eyes);
-                                       emit_video (last->second, j);
+                                       shared_ptr<PlayerVideo> copy = last->second->shallow_copy();
+                                       copy->set_eyes (eyes);
+                                       emit_video (copy, j);
                                } else {
                                        emit_video (black_player_video_frame(eyes), j);
                                }
index d3f09947eeae77966c56f9a8ab4120ba47929882..8ff008b395a8b0ec92baf6c48ad6c81e934ec8d5 100644 (file)
@@ -258,3 +258,21 @@ PlayerVideo::memory_used () const
 {
        return _in->memory_used();
 }
+
+/** @return Shallow copy of this; _in and _subtitle are shared between the original and the copy */
+shared_ptr<PlayerVideo>
+PlayerVideo::shallow_copy () const
+{
+       return shared_ptr<PlayerVideo>(
+               new PlayerVideo(
+                       _in,
+                       _crop,
+                       _fade,
+                       _inter_size,
+                       _out_size,
+                       _eyes,
+                       _part,
+                       _colour_conversion
+                       )
+               );
+}
index fe7ae384e13114bb171c703b6d47804f305c1d03..a6e39d66e8196668ef9998eff4c8beb7acbe63a2 100644 (file)
@@ -55,6 +55,8 @@ public:
 
        PlayerVideo (boost::shared_ptr<cxml::Node>, boost::shared_ptr<Socket>);
 
+       boost::shared_ptr<PlayerVideo> shallow_copy () const;
+
        void set_subtitle (PositionImage);
 
        void prepare ();