Fix _audio_pts_offset setup when we are only processing audio.
authorCarl Hetherington <cth@carlh.net>
Thu, 29 Aug 2013 11:42:45 +0000 (12:42 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 29 Aug 2013 11:42:45 +0000 (12:42 +0100)
ChangeLog
src/lib/ffmpeg_decoder.cc

index 08d1f5d5a4745dbbb58aa23c3b74a61b69f05384..64cc32926a0a4d698d9a1ee8482b375df7e4cae1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2013-08-29  Carl Hetherington  <cth@carlh.net>
 
+       * Fix emissions of large chunks of silence when
+       analysing audio in some cases.
+
        * Use my @dcpomatic.com email address for now,
        rather than a non-existant mailing list.
 
index ede724b5f26e9d03fdb85223a8a05985c89ceeb8..8da607e7eb62861812d035d88461f39fc83c1bcd 100644 (file)
@@ -97,6 +97,8 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> f, shared_ptr<const FFmpegC
                _video_pts_offset = _audio_pts_offset = - min (c->first_video().get(), c->audio_stream()->first_audio.get());
        } else if (have_video) {
                _video_pts_offset = - c->first_video().get();
+       } else if (have_audio) {
+               _audio_pts_offset = - c->audio_stream()->first_audio.get();
        }
 
        /* Now adjust both so that the video pts starts on a frame */
@@ -385,7 +387,7 @@ FFmpegDecoder::decode_audio_packet ()
                                /* Where we are in the source, in seconds */
                                double const pts = av_q2d (_format_context->streams[copy_packet.stream_index]->time_base)
                                        * av_frame_get_best_effort_timestamp(_frame) + _audio_pts_offset;
-                               
+
                                if (pts > 0) {
                                        /* Emit some silence */
                                        shared_ptr<AudioBuffers> silence (