Reclaimable paired clocked streams and original-owner recovery¶
open_reclaimable_clocked_duplex adds an explicit f32 input/output pair with a
control retirement worker. Its nominal rates, corrected sinc/FIFO profile,
channel/ring/frame bounds and initial capture priming are the existing clocked
profile. No device/rate/format fallback or default changes. Opening retains the
original processor on ordinary preflight/preparation/spawn errors. A native build
failure may have handed callback owners to the backend and returns pending
ownership with the original error. PreparedDuplex::new_owned and
PreparedClockedDuplex::new_owned likewise retain the original processor/raw
capture consumer on normal failure; their legacy new signatures are preserved.
Fallible scratch reserves precede child preparation; failed child prepare must
leave it inactive. Foreign lifecycle panics remain exceptional.
A unique input data guard borrows the prepared capture field and a unique output data guard borrows the disjoint prepared clocked renderer field. Two error guards access atomic telemetry. All captures retain a preallocated shared cell; the control worker retains its permanent owner. Guard Drop only publishes its Release flag and drops a non-last reference. Reclamation requires all four callback retirement flags acquired and stable sole strong ownership, including actual guard field destruction. It does not infer retirement from pause, stream Drop returning, flags alone or a retirement receiver being dropped early. No producer, consumer, DSP, scratch or counter storage is disposed by a framework callback capture. Native CPAL/OS callback/destructor internals retain their separate limits.
stop drops both native streams on control and returns ClockedDuplexRetirement.
try_reclaim never waits; wait is explicitly blocking control work without a
shutdown deadline. Dropping the receiver detaches the worker, which retains both
prepared owners until proof and disposes the result there if nobody receives it.
Normal completion and caught worker-poll fault are distinct outcomes, each with
exclusive stopped ownership and input/output/clock/panic statistics. Processing
panic permanently disables that data guard and makes histories exceptional; no
valid-history or audible-delivery guarantee follows.
The stopped wrapper exposes no rendering or mutable processor. into_parts
deactivates the original prepared processor once and returns it together with the
original matching raw consumer and prepared capture producer. Transient converted
queue/scratch and prefetched capture are disposed on control; actual remaining
queued raw frames retain their position. No hidden reset, seek, worker join, source
rollback or migration occurs. The recovered W215 wrapper can be consumed into its
original buffered file and child processor, then used for stopped failed/successful
indexed seeks and explicit fresh preparation. Original file counts/generation
remain authoritative. A live seek mailbox remains a separate capability.
RecoveringReclaimableClockedDuplex is an explicit caller-serviced selected-ID
coordinator over Owned, Live, Retiring and Disabled ownership states. Fault,
removal, request_reopen or disable stops both streams. Pending and disabled
service only polls retirement and never opens or invokes restoration. Known live
backend/capture/output panic faults retire before ID enumeration; repeated enumeration
errors cannot keep a known faulted pair live. A healthy pair retains its owners and
returns the original enumeration error without treating failure as device absence. After proof,
the original processor and stopped receipt are retained; the next available
service invokes the caller restoration hook before fresh preparation. A normal
hook error keeps the same, possibly advanced/mutated processor and receipt for
explicit retry. A successful hook consumes that receipt once; later ordinary open
failure retains immediate or pending ownership without rerunning successful
restoration. Start failure returns its original error and enters retirement.
Successful started opens advance generation; failed attempts do not. Disable may
still poll old retirement into a retained owner, and re-enable resumes the explicit
sequence. into_owner returns the original processor or pending proof, never
extracting from live callbacks. Exceptional failed retirement is Lost, with no
false ownership receipt.
Restoration belongs to the caller: reset/rebuild file/DSP histories, select a
stopped seek and decide how to handle worker-poll or processing panic evidence.
Device recovery watches backend/panic telemetry, while ordinary child DSP faults
keep their existing explicit reset/reopen policy. No background polling timer,
hotplug subscription, automatic fallback/state migration, synchronized stream
starts, timestamp alignment, latency, long-session drift or native deadline claim.
Focused acceptance includes guarded callback composition, synthetic asynchronous
backend/recovery behavior and two short silent paired CoreAudio cycles on one USB
interface. These runs establish original-owner retirement and reopening only.
Use cargo run -p ravet-device-probe --bin reclaimable-clocked-duplex -- --list
for read-only inventory. The explicit --validate-silent INPUT_ID OUTPUT_ID mode
opens the selected pair for two short silent cycles; it has no format/rate fallback.