Skip to content

Refactor decoder processing loop#959

Open
sbooth wants to merge 5 commits into
mainfrom
decode-refactor
Open

Refactor decoder processing loop#959
sbooth wants to merge 5 commits into
mainfrom
decode-refactor

Conversation

@sbooth

@sbooth sbooth commented Jul 15, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 15, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the audio decoding thread’s main processing loop in AudioPlayer into smaller helper methods, aiming to improve readability and separation of responsibilities in the decoder pipeline.

Changes:

  • Extracts cancellation, seek handling, dequeue/prepare, format-configuration, decode/write, and timeout logic into dedicated helper methods.
  • Introduces new decoding-related private APIs in AudioPlayer.h to support the refactored loop.
  • Applies minor line-wrapping/comment formatting updates in rendering-related sections.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
Sources/CSFBAudioEngine/Player/AudioPlayer.mm Refactors decoder processing loop into helper functions and adjusts related decode/buffer logic.
Sources/CSFBAudioEngine/Player/AudioPlayer.h Adds private helper method declarations for the refactored decoding loop.

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

Comment thread Sources/CSFBAudioEngine/Player/AudioPlayer.h
Comment thread Sources/CSFBAudioEngine/Player/AudioPlayer.h Outdated
Comment on lines +1451 to +1456
if (buffer != nil) {
auto format = buffer.format;
if (format.channelCount == renderFormat.channelCount && format.sampleRate == renderFormat.sampleRate) {
return true;
}
}
Comment on lines +1600 to +1603
// Clear the mute flag if needed now that the ring buffer is full
if (bits::is_set(flags, Flags::isMuted)) {
clearFlags(Flags::isMuted);
}
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