[domistream] RTSP server: tests first (in-memory client/server session, order, Session, ANNOUNCE parser, DESCRIBE writer, caps); API stubs return Unimplemented

This commit is contained in:
2026-12-04 12:23:48 +01:00
parent 33b7b90b65
commit 54bc9f5faf
6 changed files with 1720 additions and 8 deletions
@@ -0,0 +1,46 @@
//! The DESCRIBE answer (`docs/PROTOCOL.md` 2.3, 2.5): what the host offers, written as the SDP lines the client
//! reads with [`crate::rtsp::HostCapabilities::from_sdp`].
use crate::rtsp::sdp::{EncryptionFlags, FeatureFlags, OpusConfig};
use crate::{Error, Result};
/// What the host offers: written into the DESCRIBE answer, and checked against the client's ANNOUNCE.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct HostOffer {
/// `x-ss-general.featureFlags` (pen/touch, controller touch).
pub feature_flags: FeatureFlags,
/// `x-ss-general.encryptionSupported`.
pub encryption_supported: EncryptionFlags,
/// `x-nv-video[0].refPicInvalidation:1`: the host can invalidate reference frames.
pub reference_frame_invalidation: bool,
/// H.264: `a=fmtp:96 packetization-mode=1`.
pub h264: bool,
/// HEVC. No DESCRIBE line is known for it (a host advertises it in serverinfo, `docs/PROTOCOL.md` 1.2, U25);
/// used only to check ANNOUNCE.
pub hevc: bool,
/// AV1: `a=rtpmap:98 AV1/90000`.
pub av1: bool,
/// HDR. No DESCRIBE line is known for it (serverinfo again); used only to check ANNOUNCE: without it, a
/// `dynamicRangeMode` other than 0 (SDR [M]) is refused.
pub hdr: bool,
/// 4:4:4 chroma. No DESCRIBE line is known; used only to check ANNOUNCE.
pub yuv444: bool,
/// One `a=fmtp:97 surround-params=…` line each, in order (at most
/// [`crate::rtsp::sdp::MAX_OPUS_CONFIGS`]). The mappings are written as given: whether a host must rotate the
/// 5.1/7.1 normal-quality mappings is UNKNOWN U26.
pub opus_configs: Vec<OpusConfig>,
}
/// Builds the DESCRIBE payload for `offer`, in the line order a known host uses (`docs/PROTOCOL.md` 2.5 [M]):
/// feature flags, encryption, `sprop-parameter-sets`, reference invalidation, AV1, H.264, then one
/// `surround-params` line per Opus configuration. CRLF line ends.
///
/// # Errors
/// [`Error::Malformed`] for an Opus configuration that the client's `surround-params` parser would refuse (more
/// than 8 channels, a mapping entry or count above 9, a wrong mapping length, no streams, more coupled streams than
/// streams); [`Error::TooLarge`] over [`crate::rtsp::sdp::MAX_OPUS_CONFIGS`]; [`Error::Unsupported`] when no codec
/// is offered.
pub fn build_describe(offer: &HostOffer) -> Result<Vec<u8>> {
let _ = offer;
Err(Error::Unimplemented)
}