Skip to content

Isolate Linux audio decode and output failures from video - #957

Closed
zortos293 wants to merge 1 commit into
capy/fix-bounded-opus-packetfrom
dev
Closed

zortos293 wants to merge 1 commit into
capy/fix-bounded-opus-packetfrom
dev

Conversation

@zortos293

Copy link
Copy Markdown
Collaborator

Stack

Depends on #955. This PR contains only audio failure isolation on top of the reviewed PLC change.

Changes

Keep malformed Opus and unrecoverable audio-output failures inside the audio worker instead of failing the shared video session. Attribute decode failures to Opus and output failures to the actual sink.

Eight consecutive decode rejections trigger a decoder rebuild, with at most two rebuilds per session. A continuously rejected stream disables audio after 24 rejected packets. An unrecoverable sink failure also disables audio without switching a fixed output route or stopping video.

Publish terminal audio state before queue closure and classify concurrent submissions as audio-disabled, not fatal queue errors. Advance the concealment timeline after a rejected packet so the next packet cannot replay an already-concealed interval.

Verification

Independently reviewed and reran:

  • Real-libopus audio tests: 20 passed, 2 existing hardware-dependent tests ignored.
  • Linux session tests, including real ALSA null and /dev/full failure fixtures: 15 passed.
  • Core audio feedback tests: passed.
  • Full combined streamer workspace: all passed, including 110 Linux platform tests and 192 transport tests.
  • Formatting and Clippy with warnings denied: passed.

Limits

No live GFN session, GPU-backed embedded monitor, or physical PipeWire device-change test was available. Worker and core-feedback tests prove isolation locally; live Qt session behavior remains unverified. Audio unavailable is terminal for that session after the bounded recovery policy is exhausted.

Open in Capy

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 9f43277e-822b-43fe-9deb-595ae537308b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@capy-ai capy-ai Bot 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.

Capy found 1 potential issue (1 medium).

View 2 other findings in Capy.

Open in Capy

Comment on lines +1006 to +1013
let message = error.to_string();
emit(
events,
BackendEvent::AudioOutputError {
backend: *backend,
message: message.clone(),
},
);

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.

Medium: Successful audio sink fallback still reports an unrecovered DeviceLost

When the primary ALSA/PipeWire write fails but open_audio_fallback opens a working sink and writes the PCM, write_audio still emits AudioOutputError for the primary failure before switching. The Linux monitors map every AudioOutputError to MediaFeedback::DeviceLost with recovered: false, so core/Qt record a warn-level device-state loss and increment deviceLossCount even though audio continued on the fallback backend (only AudioSelected follows). Previously a successful fallback emitted no loss event. Emit AudioOutputError only on terminal output failure, or pair a successful fallback with DeviceLost { recovered: true } (or skip the loss feedback when fallback write succeeds).

Open in Capy

@capy-ai

capy-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Closing this malformed PR as part of the user-authorized branch repair. Its head was incorrectly published as dev; the exact audio commits are preserved on dedicated topic branches. dev will be restored to 7a76b0c965087750d46411901ce8d04ba1b2524a with an exact force-with-lease, and replacement review PRs will retain the unchanged implementation.

@capy-ai

capy-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Branch repair is complete. Replacement PR: #960, now with source capy/linux-audio-isolation-review and base capy/linux-opus-plc-review from #959. Both original commits are preserved unchanged; dev is back at 7a76b0c965087750d46411901ce8d04ba1b2524a.

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.

1 participant