Fix problems when starting to play after a seek, if the start
authorCarl Hetherington <cth@carlh.net>
Mon, 25 Nov 2019 23:32:37 +0000 (00:32 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 8 Jan 2020 20:56:47 +0000 (21:56 +0100)
of playback happens while we are awaiting an idle handler to
go through to update the view after the seek.

If this idle handler has not gone through the viewer will report
an incorrect position, which is used by the FilmViewer to start
the audio stream at the wrong time.

src/wx/film_viewer.cc

index 7040886457a97370bd3186b563428b38a597f040..3a593fc556b80cd1babfba5a6dcd5c69b272a07f 100644 (file)
@@ -314,6 +314,14 @@ FilmViewer::start ()
                return;
        }
 
                return;
        }
 
+       /* We are about to set up the audio stream from the position of the video view.
+          If there is `lazy' seek in progress we need to wait for it to go through so that
+          _video_view->position() gives us a sensible answer.
+        */
+       while (_idle_get) {
+               idle_handler ();
+       }
+
        if (_audio.isStreamOpen()) {
                _audio.setStreamTime (_video_view->position().seconds());
                _audio.startStream ();
        if (_audio.isStreamOpen()) {
                _audio.setStreamTime (_video_view->position().seconds());
                _audio.startStream ();