1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! RTP fixed header + CSRC list + generic header extension — RFC 3550 §5.1 /
//! §5.3.1, spec-complete (not just a happy-path subset).
//!
//! This crate implements exactly the wire structures described in the curated
//! spec transcription at `rtp-packet/docs/rtp-header.md` (fetched directly
//! from [RFC 3550](https://www.rfc-editor.org/rfc/rfc3550.txt)) — cite that
//! file, not this doc comment, as the field-semantics oracle.
//!
//! - [`RtpPacket`] — the §5.1 fixed header (version/padding/extension bit/
//! CSRC-count/marker/payload-type/sequence-number/timestamp/SSRC), the CSRC
//! identifier list (0–15 entries), the optional §5.3.1 header extension, an
//! optional trailing padding region, and the payload.
//! - [`HeaderExtension`] — the §5.3.1 generic header extension: a 16-bit
//! profile-specific identifier + opaque profile-specific data.
//!
//! `version`/`P`/`X`/`CC` are never stored as independent fields that could
//! disagree with the typed data: `version` is fixed at 2 by the spec (checked
//! on parse, always written on serialize), and `P`/`X`/`CC` are derived from
//! `padding.is_some()` / `extension.is_some()` / `csrc.len()` respectively —
//! see [`RtpPacket`]'s doc for the reasoning.
//!
//! Depends only on `broadcast-common`. `#![no_std]` (+ `alloc`) when the
//! `std` feature is disabled.
//!
//! The optional `rfc8285` feature adds [`rfc8285`], a decoder for [RFC
//! 8285](https://www.rfc-editor.org/rfc/rfc8285.txt)'s one-byte/two-byte
//! multiplexed extension elements that a profile may pack into
//! [`HeaderExtension::data`] — see `rtp-packet/docs/rfc8285_header_ext.md`
//! for the curated transcription. It is additive and off by default: most
//! RTP consumers only need the RFC 3550 fixed header.
//!
//! # Examples
//!
//! Build a simple packet (no padding/CSRC/extension) and round-trip it:
//!
//! ```
//! use broadcast_common::{Parse, Serialize};
//! use rtp_packet::RtpPacket;
//!
//! let pkt = RtpPacket {
//! marker: true,
//! payload_type: 96,
//! sequence_number: 1,
//! timestamp: 3600,
//! ssrc: 0x1234_5678,
//! csrc: vec![],
//! extension: None,
//! padding: None,
//! payload: &[0xDE, 0xAD, 0xBE, 0xEF],
//! };
//! let mut bytes = vec![0u8; pkt.serialized_len()];
//! pkt.serialize_into(&mut bytes).unwrap();
//! assert_eq!(RtpPacket::parse(&bytes).unwrap(), pkt);
//! ```
// Runnable examples, embedded so they render on docs.rs and stay in sync with
// the actual `examples/*.rs` files (shown, not compiled).
extern crate alloc;
pub use ;
pub use ;