diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-05-24 14:31:32 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-05-24 14:31:32 +1000 |
| commit | fb6b0ed49c3f4fe84d7708135e02cacfc6e7ceff (patch) | |
| tree | 4678f180e9a775ffed0d480cbeedc31a0190f7af /src/tangara/audio/stream_cues.cpp | |
| parent | d948585b00b4d08869417ee6169aae9ea39dde0a (diff) | |
| download | tangara-fw-fb6b0ed49c3f4fe84d7708135e02cacfc6e7ceff.tar.gz | |
Fix counting empty stream cues as the current stream
Diffstat (limited to 'src/tangara/audio/stream_cues.cpp')
| -rw-r--r-- | src/tangara/audio/stream_cues.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tangara/audio/stream_cues.cpp b/src/tangara/audio/stream_cues.cpp index 7a6a1426..6a9a7674 100644 --- a/src/tangara/audio/stream_cues.cpp +++ b/src/tangara/audio/stream_cues.cpp @@ -24,6 +24,7 @@ auto StreamCues::update(uint32_t sample) -> void { } now_ = sample; + // Advance the current queue until we've caught up. while (!upcoming_.empty() && upcoming_.front().start_at <= now_) { current_ = upcoming_.front(); upcoming_.pop_front(); @@ -59,7 +60,8 @@ auto StreamCues::current() -> std::pair<std::shared_ptr<TrackInfo>, uint32_t> { } auto StreamCues::hasStream() -> bool { - return current_ || !upcoming_.empty(); + // 'current_' might be tracking how long we've been playing nothing for. + return (current_ && current_->track) || !upcoming_.empty(); } } // namespace audio |
