summaryrefslogtreecommitdiff
path: root/src/lib/audio_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-02-28 11:09:38 +0000
committerCarl Hetherington <cth@carlh.net>2017-04-19 23:04:32 +0100
commit17e80bc37eea735629e13f068005653428c44cce (patch)
treec7d89d73f77fd69182b620c6a65b6e57722b4175 /src/lib/audio_decoder.cc
parent67826e691516e9bbb468ab62737e81e5e2eeeedf (diff)
Some comments and a few small cleanups.
Diffstat (limited to 'src/lib/audio_decoder.cc')
-rw-r--r--src/lib/audio_decoder.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc
index 31f713fda..3e4584a3f 100644
--- a/src/lib/audio_decoder.cc
+++ b/src/lib/audio_decoder.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -36,6 +36,7 @@ using boost::optional;
AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, shared_ptr<Log> log)
: DecoderPart (parent, log)
{
+ /* Set up _positions so that we have one for each stream */
BOOST_FOREACH (AudioStreamPtr i, content->streams ()) {
_positions[i] = 0;
}
@@ -49,6 +50,11 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data,
}
if (_positions[stream] == 0) {
+ /* This is the first data we have received since initialisation or seek. Set
+ the position based on the ContentTime that was given. After this first time
+ we just count samples, as it seems that ContentTimes are unreliable from
+ FFmpegDecoder (not quite continuous; perhaps due to some rounding error).
+ */
_positions[stream] = time.frames_round (stream->frame_rate ());
}