Skip to main content

parse_frames

Function parse_frames 

Source
pub fn parse_frames(buf: &[u8]) -> Result<(Vec<InterleavedFrame>, usize)>
Expand description

Streaming demultiplexer for a run of interleaved frames (RFC 2326 §10.12).

Parses as many complete frames as buf contains, starting at offset 0, and returns them together with the count of trailing bytes that form an incomplete frame (the “remainder”). The caller keeps buf[buf.len() - remainder ..] and prepends it to the next chunk.

This function assumes the buffer starts on a frame boundary (a $). It is used by the engine only after it has classified the leading byte as $; mixed RTSP-message / $-frame streams are dispatched at a higher level.