fix(audio): keep splash close from stopping playback#35
Conversation
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR hardens the audio system and improves lifecycle safety: decoder panics are now caught and reported rather than silently killing the thread; WASAPI exclusive mode state is tracked accurately across output initialization, device switching, and preference changes; and window destruction events are filtered to prevent spurious audio shutdown on non-main window close. ChangesAudio System Reliability and State Integrity
Sequence DiagramsequenceDiagram
participant DecoderSpawner
participant DecoderThread
participant CatchUnwind
participant AudioEngine
participant Analytics
DecoderSpawner->>DecoderThread: spawn_decoder_thread
DecoderThread->>CatchUnwind: catch_unwind(decoder_loop)
CatchUnwind->>DecoderThread: panic occurs
DecoderThread->>AudioEngine: emit EVENT_ERROR with crash message
DecoderThread->>AudioEngine: transition to PlayerState::Idle
DecoderThread->>Analytics: send error context
DecoderThread->>DecoderThread: exit gracefully via loop break
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src-tauri/src/audio/decoder.rs`:
- Around line 121-145: The recovery loop around catch_unwind(decoder_loop(...))
can spin indefinitely on persistent panics; modify the loop in the decoder
thread to add a capped retry count and exponential backoff (e.g., track retries,
sleep between attempts) and stop retrying after the max (emit a final
EVENT_ERROR/ErrorPayload, call transition_state(&shared, &app,
PlayerState::Idle, None) and break or return), ensure you still capture the
panic message via panic_payload_message and log it with tracing::error before
sleeping/retrying, and reset retry count on a successful Ok(()) return.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b0a13e6c-f0ef-4c65-8aa2-2a2fdb9b6cf6
📒 Files selected for processing (5)
src-tauri/src/audio/decoder.rssrc-tauri/src/audio/engine.rssrc-tauri/src/audio/output.rssrc-tauri/src/audio/wasapi_exclusive.rssrc-tauri/src/lib.rs
…ive mode management
305c68f to
27cfdf7
Compare
Summary
player:errorinstead of leaving a closed command channel.Verification
cargo check --manifest-path src-tauri/Cargo.toml --all-targetsSummary by CodeRabbit