Fix skip-frame.
[dcpomatic.git] / src / lib / player.cc
index dffe7dbee52d3a7bde7372dde98464d9c8f99b2f..7d53b07bfe104ce90c113958023087c1cb72d27a 100644 (file)
@@ -545,9 +545,12 @@ Player::pass ()
                DCPTime t = _last_audio_time;
                while (t < length) {
                        DCPTime block = min (DCPTime::from_seconds (0.5), length - t);
-                       shared_ptr<AudioBuffers> silence (new AudioBuffers (_film->audio_channels(), block.frames_round(_film->audio_frame_rate())));
-                       silence->make_silent ();
-                       Audio (silence, t);
+                       Frame const samples = block.frames_round(_film->audio_frame_rate());
+                       if (samples) {
+                               shared_ptr<AudioBuffers> silence (new AudioBuffers (_film->audio_channels(), samples));
+                               silence->make_silent ();
+                               Audio (silence, t);
+                       }
                        t += block;
                }
 
@@ -594,6 +597,11 @@ Player::video (weak_ptr<Piece> wp, ContentVideo video)
                return;
        }
 
+       FrameRateChange frc(piece->content->active_video_frame_rate(), _film->video_frame_rate());
+       if (frc.skip && (video.frame % 2) == 1) {
+               return;
+       }
+
        /* Time and period of the frame we will emit */
        DCPTime const time = content_video_to_dcp (piece, video.frame);
        DCPTimePeriod const period (time, time + DCPTime::from_frames (1, _film->video_frame_rate()));