From a5d5ceb22c4f5dd3e6c5b7a8da76f724dd266a75 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 31 Jan 2018 00:25:06 +0000 Subject: Fix sequencing failure in some very specific circumstances. --- src/lib/player.cc | 5 +++-- src/lib/player_video.cc | 18 ++++++++++++++++++ src/lib/player_video.h | 2 ++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/lib/player.cc b/src/lib/player.cc index 3d5762740..9ee8ab72c 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -715,8 +715,9 @@ Player::video (weak_ptr 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 copy = last->second->shallow_copy(); + copy->set_eyes (eyes); + emit_video (copy, j); } else { emit_video (black_player_video_frame(eyes), j); } diff --git a/src/lib/player_video.cc b/src/lib/player_video.cc index d3f09947e..8ff008b39 100644 --- a/src/lib/player_video.cc +++ b/src/lib/player_video.cc @@ -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::shallow_copy () const +{ + return shared_ptr( + new PlayerVideo( + _in, + _crop, + _fade, + _inter_size, + _out_size, + _eyes, + _part, + _colour_conversion + ) + ); +} diff --git a/src/lib/player_video.h b/src/lib/player_video.h index fe7ae384e..a6e39d66e 100644 --- a/src/lib/player_video.h +++ b/src/lib/player_video.h @@ -55,6 +55,8 @@ public: PlayerVideo (boost::shared_ptr, boost::shared_ptr); + boost::shared_ptr shallow_copy () const; + void set_subtitle (PositionImage); void prepare (); -- cgit v1.2.3