Expand description
Per-(camera, stream_kind) live media source.
A StreamSource owns a single BcCamera::start_video() stream and
fans the decoded Frames out via a tokio::sync::broadcast channel so
that many RTSP sessions can subscribe to the same camera without
opening multiple Baichuan video streams.
Responsibilities:
- Spawn a tokio task that pulls
BcMediapackets frombairelay_neolink_core. - Split Annex-B NAL streams, detect the video codec, and translate
each packet into
bairelay_rtsp::provider::Frame. - Update the shared
LastFrameBufferon I-frames / P-frames. - Maintain the
SdpParamsneeded to render the RTSPDESCRIBEbody for this source (codec, SPS/PPS/VPS). - Exit cleanly when the owning
StreamSourceis dropped (orStreamSource::stopis called) — including sending a matchingstop_videocommand to the camera.
§Audio + multi-track status
Audio flows end-to-end: BcMedia::Aac passthrough via RFC 3640
AAC-hbr, BcMedia::Adpcm transcoded to G.711 µ-law (8 kHz, static
PT 0). SdpParams.audio is populated on the first observed audio
packet; AudioPresence on the owning CameraHandle advances
Unknown → Present { codec } at the same time. Dispatch to the
right RTSP transport (video vs. audio track) happens inside
crates/rtsp/src/server/session_task.rs.
Structs§
- Fake
Frame Injector - Test-only handle for simulating a live
Frame::Videoarrival in unit tests. SeeStreamSource::start_inert_for_test_with_gap_and_injector. - Paced
Frame - Audio frame queued for paced emission to the broadcast channel.
- Stream
Source - A live
(camera, stream_kind)media source. See module docs. - Stream
Translator State - Mutable state owned by the reader task’s translator loop.
Enums§
- GapState
- Upstream live-frame presence for a
StreamSource, maintained byreader_task.
Functions§
- apply_
bcmedia_ packet - Apply a decoded
BcMediapacket to the outbound channels, maintaining all translator state viaStreamTranslatorState. - await_
audio_ or_ deadline - Wait for
SdpParams.audiospecifically to becomeSome(video is assumed populated). ReturnsOk(())on audio arrival, a static reason string on timeout. The caller re-reads the SDP snapshot after. - await_
sdp_ both - Wait until both
SdpParams.videoandSdpParams.audioare populated (Some), ortimeoutelapses. Returns the snapshot on success; a static reason string on timeout. Used byCameraProvider::subscribewhen the camera’sAudioPresenceisPresent { codec }.