From 0190f4f751f6e3d67b25cca781ad0f7ebeb936ce Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 13 Jun 2021 20:30:15 +0200 Subject: [PATCH] Ignore incoming data when suspended. Otherwise, for example, some content can be moved and before the pieces have been re-created some video can arrive. Then the video's position will be calculated using the content's new position, causing an apparently big gap in the video which is filled in with black. These extra black frames cause the video buffers to fill up without any audio. --- src/lib/player.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/lib/player.cc b/src/lib/player.cc index 0bdf46f4a..3a098c38e 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -841,6 +841,10 @@ Player::open_subtitles_for_frame (DCPTime time) const void Player::video (weak_ptr wp, ContentVideo video) { + if (_suspended) { + return; + } + auto piece = wp.lock (); if (!piece) { return; @@ -951,6 +955,10 @@ Player::video (weak_ptr wp, ContentVideo video) void Player::audio (weak_ptr wp, AudioStreamPtr stream, ContentAudio content_audio) { + if (_suspended) { + return; + } + DCPOMATIC_ASSERT (content_audio.audio->frames() > 0); auto piece = wp.lock (); @@ -1021,6 +1029,10 @@ Player::audio (weak_ptr wp, AudioStreamPtr stream, ContentAudio content_a void Player::bitmap_text_start (weak_ptr wp, weak_ptr wc, ContentBitmapText subtitle) { + if (_suspended) { + return; + } + auto piece = wp.lock (); auto text = wc.lock (); if (!piece || !text) { @@ -1060,6 +1072,10 @@ Player::bitmap_text_start (weak_ptr wp, weak_ptr wc, C void Player::plain_text_start (weak_ptr wp, weak_ptr wc, ContentStringText subtitle) { + if (_suspended) { + return; + } + auto piece = wp.lock (); auto text = wc.lock (); if (!piece || !text) { @@ -1105,6 +1121,10 @@ Player::plain_text_start (weak_ptr wp, weak_ptr wc, Co void Player::subtitle_stop (weak_ptr wp, weak_ptr wc, ContentTime to) { + if (_suspended) { + return; + } + auto text = wc.lock (); if (!text) { return; @@ -1354,6 +1374,10 @@ Player::playlist () const void Player::atmos (weak_ptr, ContentAtmos data) { + if (_suspended) { + return; + } + Atmos (data.data, DCPTime::from_frames(data.frame, _film->video_frame_rate()), data.metadata); } -- 2.30.2