summaryrefslogtreecommitdiff
path: root/src/lib/audio_decoder_stream.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-11-21 10:35:48 +0000
committerCarl Hetherington <cth@carlh.net>2016-11-21 10:35:48 +0000
commit5b2b4ad4477561120973be08ae9299f21f5533a0 (patch)
tree484f57bc5fe4764b6b6a65ab768f4debbb67e476 /src/lib/audio_decoder_stream.cc
parentf02d4c995a312e7ccf2eac7a2cb71d8e68d77189 (diff)
Fix thinko in deciding where to seek in audio decoder stream; still more debug logging.
Diffstat (limited to 'src/lib/audio_decoder_stream.cc')
-rw-r--r--src/lib/audio_decoder_stream.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib/audio_decoder_stream.cc b/src/lib/audio_decoder_stream.cc
index ef67b94f1..af46593ab 100644
--- a/src/lib/audio_decoder_stream.cc
+++ b/src/lib/audio_decoder_stream.cc
@@ -71,7 +71,12 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
{
shared_ptr<ContentAudio> dec;
- _log->log (String::compose ("ADS has request for %1 %2", frame, length), LogEntry::TYPE_DEBUG_DECODE);
+ _log->log (
+ String::compose (
+ "ADS has request for %1 %2; has %3 %4",
+ frame, length, _decoded.frame, _decoded.audio->frames()
+ ), LogEntry::TYPE_DEBUG_DECODE
+ );
Frame const from = frame;
Frame const to = from + length;
@@ -81,7 +86,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
optional<Frame> missing;
if (have_from > from || have_to < to) {
/* We need something */
- if (have_from < from && from < have_to) {
+ if (have_from <= from && from < have_to) {
missing = have_to;
} else {
missing = from;
@@ -89,7 +94,11 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
}
if (missing) {
- _log->log (String::compose ("ADS suggests seek to %1", *missing), LogEntry::TYPE_DEBUG_DECODE);
+ optional<ContentTime> pos = _audio_decoder->position ();
+ _log->log (
+ String::compose ("ADS suggests seek to %1 (now at %2)", *missing, pos ? to_string(pos.get()) : "none"),
+ LogEntry::TYPE_DEBUG_DECODE
+ );
_audio_decoder->maybe_seek (ContentTime::from_frames (*missing, _content->resampled_frame_rate()), accurate);
}