Fix counting empty stream cues as the current stream

custom
jacqueline 11 months ago
parent d948585b00
commit fb6b0ed49c
  1. 4
      src/tangara/audio/stream_cues.cpp

@ -24,6 +24,7 @@ auto StreamCues::update(uint32_t sample) -> void {
} }
now_ = sample; now_ = sample;
// Advance the current queue until we've caught up.
while (!upcoming_.empty() && upcoming_.front().start_at <= now_) { while (!upcoming_.empty() && upcoming_.front().start_at <= now_) {
current_ = upcoming_.front(); current_ = upcoming_.front();
upcoming_.pop_front(); upcoming_.pop_front();
@ -59,7 +60,8 @@ auto StreamCues::current() -> std::pair<std::shared_ptr<TrackInfo>, uint32_t> {
} }
auto StreamCues::hasStream() -> bool { 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 } // namespace audio

Loading…
Cancel
Save