Refactor decoder processing loop#959
Open
sbooth wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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.hto 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 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); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.