Remove spurious fills of audio data.
authorCarl Hetherington <cth@carlh.net>
Sat, 17 Jun 2017 23:46:35 +0000 (00:46 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 17 Jun 2017 23:46:35 +0000 (00:46 +0100)
With a 29.97 source I had problems because the earliest decoder position was
one DCPTime quantum ahead of the last audio time; this looks like it was due to
the content-to-DCP time conversion using 1.001 as the ratio for 30/29.97 rather than
1.001001; I haven't investigated why.  This all needs more careful consideration...

src/lib/player.cc

index 5c84ea5f525fe35786503ad081ebf956812decda..82159df719800fc36028267160472f3087fe453d 100644 (file)
@@ -565,7 +565,7 @@ Player::pass ()
                audio_fill_towards += DCPTime::from_seconds (earliest->content->audio->delay() / 1000.0);
        }
 
-       if (audio_fill_from && audio_fill_from < audio_fill_towards) {
+       if (audio_fill_from && audio_fill_from < audio_fill_towards && ((audio_fill_towards - *audio_fill_from) >= one_video_frame())) {
                DCPTimePeriod period (*audio_fill_from, audio_fill_towards);
                if (period.duration() > one_video_frame()) {
                        period.to = period.from + one_video_frame();
@@ -919,7 +919,7 @@ void
 Player::emit_audio (shared_ptr<AudioBuffers> data, DCPTime time)
 {
        Audio (data, time);
-       _last_audio_time = time + DCPTime::from_frames (data->frames(), _film->audio_frame_rate ());
+       _last_audio_time = time + DCPTime::from_frames (data->frames(), _film->audio_frame_rate());
 }
 
 void