From 5374dde4a0057066697c4963ce30f025980dc3c1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 19 Mar 2025 01:04:43 +0100 Subject: Seek the player before creating a new butler. Consider the case where we switch to a different sound card when the player GUI is showing frame 0. At this point, the butler will be full up to some readahead, so the player will also "think" it's at the readahead position. If we create a new butler, the first get of video from the new buffer would previously return a frame from the readahead position (because that's where the player was). Since the new butler would coincide with the audio stream position being 0, the video thread would think it was ahead by the ring buffer readahead and so would sleep for quite a long time. Meanwhile audio arrives and is played, and when the video thread finally wakes it is a long time behind the audio. --- src/wx/film_viewer.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index a7a2ab984..26c3467aa 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -238,6 +238,7 @@ FilmViewer::create_butler() #endif DCPOMATIC_ASSERT(_player); + _player->seek(_video_view->position(), true); auto& audio = AudioBackend::instance()->rtaudio(); -- cgit v1.2.3