Skip to content

Don't drain ring buffer if not needed#926

Merged
sbooth merged 7 commits into
mainfrom
no-drain
Jun 6, 2026
Merged

Don't drain ring buffer if not needed#926
sbooth merged 7 commits into
mainfrom
no-drain

Conversation

@sbooth
Copy link
Copy Markdown
Owner

@sbooth sbooth commented Jun 6, 2026

No description provided.

Copilot AI review requested due to automatic review settings June 6, 2026 18:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts decoder-cancellation handling in AudioPlayer’s decoding thread to avoid requesting a ring-buffer drain when canceling decoders that have not yet been initialized, reducing unnecessary drain cycles and potential audible disruption.

Changes:

  • Cache DecoderState flags once per iteration when processing cancellations.
  • Only mark the ring buffer as stale on cancellation when the canceled decoder has completed initialization (needsInitialization is clear).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Sources/CSFBAudioEngine/Player/AudioPlayer.mm
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Used clang-format v22.1.7

Click here for the full clang-format patch
diff --git a/Sources/CSFBAudioEngine/Player/AudioPlayer.mm b/Sources/CSFBAudioEngine/Player/AudioPlayer.mm
index 0efa545..11354d5 100644
--- a/Sources/CSFBAudioEngine/Player/AudioPlayer.mm
+++ b/Sources/CSFBAudioEngine/Player/AudioPlayer.mm
@@ -1190 +1190,2 @@ void sfb::AudioPlayer::processDecoders(std::stop_token stoken) noexcept {
-                if (bits::is_set_without(flags, DecoderState::Flags::cancelRequested, DecoderState::Flags::isCanceled)) {
+                if (bits::is_set_without(flags, DecoderState::Flags::cancelRequested,
+                                         DecoderState::Flags::isCanceled)) {

Have any feedback or feature suggestions? Share it here.

Comment thread Sources/CSFBAudioEngine/Player/AudioPlayer.mm Outdated
@github-actions github-actions Bot dismissed their stale review June 6, 2026 19:08

outdated suggestion

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread Sources/CSFBAudioEngine/Player/AudioPlayer.mm Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@sbooth sbooth merged commit 787824f into main Jun 6, 2026
3 checks passed
@sbooth sbooth deleted the no-drain branch June 6, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants