summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-02-16 21:54:01 +0000
committerCarl Hetherington <cth@carlh.net>2018-02-16 21:54:01 +0000
commita8855402f9bc9815b10405ff68c313f4a4584651 (patch)
tree9dab0c174986615e425d7acb33c84769e1380879
parent34d07e62e2ca021a304cf56a3262e1e288cf0e6a (diff)
AudioDecoder::_positions is at the resampled rate, if applicable;
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.
-rw-r--r--src/lib/audio_decoder.cc2
-rw-r--r--src/lib/audio_decoder.h4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc
index 4bd6535d8..c0f00780a 100644
--- a/src/lib/audio_decoder.cc
+++ b/src/lib/audio_decoder.cc
@@ -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;
diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h
index 69655cceb..d422503a7 100644
--- a/src/lib/audio_decoder.h
+++ b/src/lib/audio_decoder.h
@@ -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;