AudioDecoder::_positions is at the resampled rate, if applicable;
authorCarl Hetherington <cth@carlh.net>
Fri, 16 Feb 2018 21:54:01 +0000 (21:54 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 16 Feb 2018 21:54:01 +0000 (21:54 +0000)
fix its initial setup.  Fixes problems when seeking deep into
resampled content; before this commit the audio time stamps got
out of whack sufficiently that the butler would fill with video
before any audio made it past the range checks.

src/lib/audio_decoder.cc
src/lib/audio_decoder.h

index 4bd6535d81a2888f98af09016652e0642dc1e674..c0f00780ad58cb852fed8c6e65a1d559aa17e075 100644 (file)
@@ -66,7 +66,7 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data,
                        silence (_content->delay ());
                }
                time += ContentTime::from_seconds (_content->delay() / 1000.0);
-               _positions[stream] = time.frames_round (stream->frame_rate ());
+               _positions[stream] = time.frames_round (_content->resampled_frame_rate ());
        }
 
        shared_ptr<Resampler> resampler;
index 69655cceb32b8d654db6d3cd33f143d5d1817a65..d422503a78b4a643afee95493ff2c3a6a09ec85d 100644 (file)
@@ -60,7 +60,9 @@ private:
        void silence (int milliseconds);
 
        boost::shared_ptr<const AudioContent> _content;
-       /** Frame after the last one that was emitted from Data for each AudioStream */
+       /** Frame after the last one that was emitted from Data (i.e. at the resampled rate, if applicable)
+        *  for each AudioStream.
+        */
        std::map<AudioStreamPtr, Frame> _positions;
        std::map<AudioStreamPtr, boost::shared_ptr<Resampler> > _resamplers;