mf_preview exists to keep native media encoding (med_ex_opus) and WebRTC
peer negotiation (med_ex_rtc) completely outside the mf_exam BEAM.
Security & Fault Boundaries
- No clinical state:
mf_previewhas no database URL, no device enrollment keys, and no access to authoritative recording volumes. - Dedicated OS isolation: Run
mf_previewunder its own OS user or mount namespace that can read only its release directory andMF_PREVIEW_CREDENTIAL_FILE. - Failure independence: If
mf_previewcrashes or is killed mid-recording, live listening stops cleanly whilemf_examcontinues recording and sealing authoritative clinical waveforms without interruption.
Frame & Peer Lifecycle
mf_examforwards validatedMedEx.Wire.FrameV1monitor frames (stream 3, 48 kHz mono PCM16LE, 960 samples / 1,920 bytes) toPOST /feedwith bearer auth andx-acquisition.MedFabric.Preview.Endpointstores only the single latest frame per acquisition in:mf_preview_feedETS and returns{"credit": 1}.- Clinician viewers negotiate via
POST /offerusing short-lived HMAC-SHA256 tokens minted bymf_exam. A replacement viewer closes the previous peer. MedFabric.Preview.Peerkeeps at most one Opus encode in flight, drops frames older than 200 ms, and exits automatically when WebRTC closes/fails or after 65 seconds without status heartbeats.