Fix problems when starting to play after a seek, if the start
[dcpomatic.git] / src / wx / film_viewer.cc
index 7040886457a97370bd3186b563428b38a597f040..3a593fc556b80cd1babfba5a6dcd5c69b272a07f 100644 (file)
@@ -314,6 +314,14 @@ FilmViewer::start ()
                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 ();