Fix assertion failure in emit_audio.
authorCarl Hetherington <cth@carlh.net>
Tue, 30 Jan 2018 00:34:13 +0000 (00:34 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 30 Jan 2018 00:34:13 +0000 (00:34 +0000)
src/lib/player.cc

index 522b8304f533aa6674fd02fb1ccef6da3fb43bdb..3d57627407d4dbdafdf24731aa0df0629b986fa6 100644 (file)
@@ -595,6 +595,14 @@ Player::pass ()
        case SILENT:
        {
                DCPTimePeriod period (_silent.period_at_position());
+               if (_last_audio_time) {
+                       /* Sometimes the thing that happened last finishes fractionally before
+                          this silence.  Bodge the start time of the silence to fix it.  I'm
+                          not sure if this is the right solution --- maybe the last thing should
+                          be padded `forward' rather than this thing padding `back'.
+                       */
+                       period.from = min(period.from, *_last_audio_time);
+               }
                if (period.duration() > one_video_frame()) {
                        period.to = period.from + one_video_frame();
                }