forge
Explore
Log in

Don't you dare go Hollow

The reason's writer is the engine lane, not this one

Browse files at this commit

a091c6dbfc3e987da6f52c6b9fd1b936c9e99c9eAhmet Kaan GümüşParent: e87ca88
  • docs
    • the reason's writer is the engine lane, not this one
Show full message
📝 docs(audio): the reason's writer is the engine lane, not this one

The documents said the engine sets `audio_disabled_reason` on a death and clears it on its re-arm. In this tree nothing assigns that field off the death path: the only mid-session writer is `arm_audio` (`crates/engine/src/playback.rs:2687`), which assigns only when `open_audio` returned a device, so it can only clear. The app side is the *reader* of whatever reason the engine reports, and it never spells the engine's words -- a death that sets nothing stays unsaid, and that is the engine lane's half of this defect.
crates/app/src/notices.rsmodified+10 -5
@@ -109,11 +109,16 @@ pub(crate) fn audio_step(
109 }109 }
110 110
111 /// What a *change* in the engine's sound reason does to the notice queue, as a111 /// What a *change* in the engine's sound reason does to the notice queue, as a
112-/// pure step: the death line pushed when a reason arrives, the same line taken112+/// pure step: the line pushed when a reason arrives, the same line taken back
113-/// back when the reason clears ([`PlaybackSession::audio_disabled_reason`]'s113+/// when the reason clears. [`Player::watch_audio`] is the only caller and owns
114-/// `AUDIO_LOST` and its own re-arm). [`Player::watch_audio`] is the only caller114+/// the caching; this owns the queue, so a test can drive both directions without
115-/// and owns the caching; this owns the queue, so a test can drive both115+/// a window and without a device that dies on cue.
116-/// directions without a window and without a device that dies on cue.116+///
117+/// The reason itself is the engine's to write
118+/// ([`PlaybackSession::audio_disabled_reason`]): this side never spells its
119+/// words, so a lost-device reason the engine lane teaches the death path to set
120+/// needs nothing here -- and a death that sets nothing stays unsaid, which is
121+/// what the engine side of this defect is.
117 pub(crate) fn audio_change_notice(122 pub(crate) fn audio_change_notice(
118 notices: &mut std::collections::VecDeque<SharedString>,123 notices: &mut std::collections::VecDeque<SharedString>,
119 was: Option<&str>,124 was: Option<&str>,
crates/app/src/tests/media.rsmodified+5 -6
@@ -16,12 +16,11 @@ use crate::ui::preview::{bgra_to_rgba, screenshot_path};
16 /// them (`notices` is a private module re-exported for the window).16 /// them (`notices` is a private module re-exported for the window).
17 use crate::notices::{audio_change_notice, audio_lost_line, audio_tail};17 use crate::notices::{audio_change_notice, audio_lost_line, audio_tail};
18 18
19-/// A sound device that dies under a file that is already open says so, and stops19+/// A reason that changes under a session that is already open says so, and stops
20-/// saying so when the engine's own re-arm takes. The engine sets its20+/// saying so when it clears. This side is the *reader*: the writer of a reason is
21-/// `audio_disabled_reason` to its lost-device word on a death and clears it on a21+/// the engine's own `audio_disabled_reason`, and the app's two call sites were
22-/// successful reopen, and nothing on this side ever looked at it: the two call22+/// the *open* paths -- so a reason that arrived mid-session reached no consumer
23-/// sites were the *open* paths, so a mid-session death played on in silence with23+/// at all and the window played on in silence with nothing said.
24-/// no message at all.
25 ///24 ///
26 /// Driven through the queue step itself -- [`audio_change_notice`] is the whole25 /// Driven through the queue step itself -- [`audio_change_notice`] is the whole
27 /// of what a reason change does to the strip -- because a test cannot make a26 /// of what a reason change does to the strip -- because a test cannot make a