refactor(playback): improved playback and public api#63
Open
Yesterday17 wants to merge 7 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the anni-playback crate to provide a configurable low-level Player plus an annil-aware AnniPlayer with variant-safe caching, expanded runtime events, and richer playback/cache statistics.
Changes:
- Reworked decoder/output pipeline for gapless preloading, accurate seeking, buffering/error reporting, and deterministic shutdown.
- Added
PlayerConfig/builder APIs, new publicstatsmodule, and expanded public events/errors. - Rebuilt HTTP + cached HTTP sources to support codec/quality variants with atomic cache publication and cache statistics.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| anni-playback/src/utils/blocking_rb.rs | Replace custom ring buffer with ArrayQueue + blocking producer / RT-safe consumer API. |
| anni-playback/src/types.rs | Add structured PlaybackError and expand internal/public events. |
| anni-playback/src/stats.rs | New playback/cache stats snapshot + internal stats handles. |
| anni-playback/src/sources/mod.rs | Remove unused legacy receiver type. |
| anni-playback/src/sources/http.rs | Simplify HTTP stream buffering; handle servers that ignore range requests. |
| anni-playback/src/sources/cached_http/provider.rs | Introduce AudioVariant/AudioCodec and safer URL formatting. |
| anni-playback/src/sources/cached_http/mod.rs | Add variant-aware caching, background download coordination, cancellation, and variant resolution. |
| anni-playback/src/sources/cached_http/cache.rs | Implement atomic “publish when complete” cache entries + cache stats. |
| anni-playback/src/player.rs | Add Player/AnniPlayer builders, lifecycle ownership, and stats accessors. |
| anni-playback/src/lib.rs | Export new config/stats APIs and expanded public surface. |
| anni-playback/src/dsp/resampler.rs | Make resampling error-aware and trim delay/padding deterministically. |
| anni-playback/src/dsp/normalizer.rs | Make normalizer initialization fallible and avoid panics. |
| anni-playback/src/decoder/opus.rs | Respect Symphonia gapless trim options in Opus decode. |
| anni-playback/src/decoder/mod.rs | Add clippy allowance for module layout. |
| anni-playback/src/decoder/decoder.rs | Major decoder refactor: lazy output init, preload pipeline, seek trimming, error/buffering events. |
| anni-playback/src/cpal_output.rs | Device config negotiation, multi-format output support, remix/downmix logic, output gating, stats hooks. |
| anni-playback/src/controls.rs | Move to decoder-confirmed events/state, add stats handle, output gate, volume atomics. |
| anni-playback/src/config.rs | New runtime configuration types with validation + tests. |
| anni-playback/Readme.md | Document new APIs, stats, preload/gapless, and annil variant caching behavior. |
| anni-playback/examples/tui.rs | Update example to use new Player builder/events. |
| anni-playback/examples/player.rs | Update example to use new Player builder/events. |
| anni-playback/examples/gapless.rs | Update example to use new preload/gapless flow and events. |
| anni-playback/CHANGELOG.md | Document major new features and behavior fixes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.