Skip to main content

o_sfu_router/model/
rtp.rs

1//! Router-native RTP model for the transport edge.
2//!
3//! This module defines the typed domain model used to describe media streams,
4//! codecs, and their negotiated properties. It sits between the signaling/SDP
5//! layer and the raw packet loop, allowing the router to reason about media
6//! without parsing raw bytes or string-heavy protocol bags.
7//!
8//! ### RTP Packet Context
9//!
10//! Most of the types defined here map directly to fields in the "RFC 3550"
11//! RTP header or its extensions:
12//!
13//! ```text
14//!  0                   1                   2                   3
15//!  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
16//! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
17//! |V=2|P|X|  CC   |M|     PT      |       Sequence Number         |
18//! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
19//! |                           Timestamp                           |
20//! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
21//! |           Synchronization Source (SSRC) identifier            |
22//! +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23//! ```
24//!
25//! - `V`: version (always 2)
26//! - `P`: padding bit
27//! - `X`: extension bit (if set, an extension header follows the SSRC)
28//! - `CC`: "CSRC count", the number of contributing source identifiers (0-15) that follow the SSRC
29//! - `M`: "Marker" bit, used by profiles to mark significant events like the end of a video frame
30//! - `PT`: "Payload Type" (identifies the codec)
31//! - `SSRC`: unique stream identifier
32//!
33//! RFC references for this module:
34//! - RTP base protocol: <https://www.rfc-editor.org/rfc/rfc3550>
35//! - RTP A/V profile payload assignments: <https://www.rfc-editor.org/rfc/rfc3551>
36//! - RTP header extension framework: <https://www.rfc-editor.org/rfc/rfc8285>
37
38use std::borrow::Cow;
39
40use o_sfu_rfc::{rtp as rfc_rtp, webrtc as rfc_webrtc};
41pub use rfc_rtp::{HeaderExtensionId, Mid, PayloadType, Rid, Ssrc};
42
43use super::MediaKind;
44
45/// Canonical name for a media codec (e.g. "opus", "vp8", "h264")
46pub type MediaCodec = rfc_rtp::CodecName;
47
48/// Uniform resource identifier for a header extension (e.g. "urn:ietf:params:rtp-hdrext:ssrc-audio-level")
49pub type HeaderExtensionUri = rfc_webrtc::RtpHeaderExtensionUri;
50
51/// Categories of feedback messages sent over RTCP to control stream behavior.
52///
53/// These define how the receiver reports issues (like packet loss) or requests
54/// changes (like a new keyframe) to the sender.
55#[derive(Debug, Clone, PartialEq, Eq)]
56pub enum RtcpFeedbackKind {
57    /// Generic NACK from
58    /// [RFC 4585 section 6.2.1](https://www.rfc-editor.org/rfc/rfc4585.html#section-6.2.1).
59    Nack,
60    /// Picture Loss Indication from
61    /// [RFC 4585 section 6.3.1](https://www.rfc-editor.org/rfc/rfc4585.html#section-6.3.1).
62    NackPli,
63    /// Full Intra Request from
64    /// [RFC 5104 section 4.3.1](https://www.rfc-editor.org/rfc/rfc5104.html#section-4.3.1).
65    CcmFir,
66    /// Google-specific receiver estimated maximum bitrate
67    GoogRemb,
68    /// Transport-wide congestion control (draft-holmer-rmcat-transport-wide-cc-extensions)
69    TransportCc,
70    /// Any other vendor-specific or experimental feedback type
71    Other(String),
72}
73
74/// One negotiated RTCP feedback mechanism for a codec.
75#[derive(Debug, Clone, PartialEq, Eq)]
76pub struct RtcpFeedback {
77    kind: RtcpFeedbackKind,
78    parameter: Option<String>,
79}
80
81impl RtcpFeedback {
82    #[must_use]
83    pub fn new(kind: RtcpFeedbackKind, parameter: Option<String>) -> Self {
84        Self { kind, parameter }
85    }
86
87    #[must_use]
88    pub fn kind(&self) -> &RtcpFeedbackKind {
89        &self.kind
90    }
91
92    #[must_use]
93    pub fn parameter(&self) -> Option<&str> {
94        self.parameter.as_deref()
95    }
96}
97
98/// Typed codec parameter that affects interoperability.
99///
100/// These correspond to "a=fmtp" parameters in SDP. Mismatched settings
101/// here usually mean the receiver cannot decode the sender's bitstream.
102#[derive(Debug, Clone, PartialEq, Eq)]
103pub enum CodecSetting {
104    /// RTX associated payload type from
105    /// [RFC 4588 section 8.1](https://www.rfc-editor.org/rfc/rfc4588.html#section-8.1).
106    RtxAssociation(PayloadType),
107    /// h264-specific packetization mode
108    H264PacketizationMode(rfc_rtp::h264::PacketizationMode),
109    /// H264 profile and level (e.g. "42e01f" for Constrained Baseline Level 3.1)
110    H264ProfileLevelId(String),
111    /// VP9-specific profile identifier
112    Vp9ProfileId(rfc_rtp::Vp9ProfileId),
113    /// OPUS-specific flag for in-band forward error correction
114    UseInBandFec(bool),
115    /// Generic catch-all for unknown or vendor parameters
116    Other { key: String, value: String },
117}
118
119impl CodecSetting {
120    #[must_use]
121    pub fn key(&self) -> &str {
122        match self {
123            Self::RtxAssociation(_) => rfc_rtp::fmtp::RTX_ASSOCIATION,
124            Self::H264PacketizationMode(_) => rfc_rtp::fmtp::H264_PACKETIZATION_MODE,
125            Self::H264ProfileLevelId(_) => rfc_rtp::fmtp::H264_PROFILE_LEVEL_ID,
126            Self::Vp9ProfileId(_) => rfc_rtp::fmtp::VP9_PROFILE_ID,
127            Self::UseInBandFec(_) => rfc_rtp::fmtp::OPUS_USE_IN_BAND_FEC,
128            Self::Other { key, .. } => key.as_str(),
129        }
130    }
131
132    #[must_use]
133    pub fn wire_value(&self) -> Cow<'_, str> {
134        match self {
135            Self::RtxAssociation(payload_type) => Cow::Owned(payload_type.value().to_string()),
136            Self::H264PacketizationMode(mode) => Cow::Owned(mode.fmtp_value().to_string()),
137            Self::H264ProfileLevelId(profile_level_id) => Cow::Borrowed(profile_level_id.as_str()),
138            Self::Vp9ProfileId(profile_id) => Cow::Owned(profile_id.value().to_string()),
139            Self::UseInBandFec(enabled) => Cow::Borrowed(if *enabled {
140                rfc_rtp::fmtp::VALUE_ENABLED
141            } else {
142                rfc_rtp::fmtp::VALUE_DISABLED
143            }),
144            Self::Other { value, .. } => Cow::Borrowed(value.as_str()),
145        }
146    }
147}
148
149/// RTP header-extension configuration (RFC 8285).
150///
151/// Allows carrying extra metadata (like bandwidth estimation hints or
152/// audio levels) in a standard way within the RTP packet header.
153///
154/// ```text
155///  0                   1                   2                   3
156///  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
157/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
158/// |      defined by profile       |           length              |
159/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
160/// |  ID   |  len  |     data...                                   |
161/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
162/// ```
163#[derive(Debug, Clone, PartialEq, Eq)]
164pub struct HeaderExtension {
165    uri: HeaderExtensionUri,
166    id: HeaderExtensionId,
167}
168
169impl HeaderExtension {
170    #[must_use]
171    pub fn new(uri: impl Into<HeaderExtensionUri>, id: impl Into<HeaderExtensionId>) -> Self {
172        Self {
173            uri: uri.into(),
174            id: id.into(),
175        }
176    }
177
178    #[must_use]
179    pub fn uri_kind(&self) -> &HeaderExtensionUri {
180        &self.uri
181    }
182
183    #[must_use]
184    pub fn id(&self) -> HeaderExtensionId {
185        self.id
186    }
187
188    #[must_use]
189    pub fn uri(&self) -> &str {
190        self.uri.as_str()
191    }
192}
193
194/// Codec capability advertised by a router or endpoint.
195///
196/// Represents one possible way an endpoint can encode or decode media.
197/// The `payload_type` is optional here because capabilities are often
198/// just templates (e.g. "i support VP8") before a concrete session pins
199/// a specific PT number.
200#[derive(Debug, Clone, PartialEq, Eq)]
201pub struct MediaCodecCapability {
202    media_kind: MediaKind,
203    codec: MediaCodec,
204    clock_rate: u32,
205    payload_type: Option<PayloadType>,
206    channels: Option<u16>,
207    settings: Vec<CodecSetting>,
208    rtcp_feedback: Vec<RtcpFeedback>,
209}
210
211impl MediaCodecCapability {
212    #[must_use]
213    pub fn new(media_kind: MediaKind, codec: impl Into<MediaCodec>, clock_rate: u32) -> Self {
214        Self {
215            media_kind,
216            codec: codec.into(),
217            clock_rate,
218            payload_type: None,
219            channels: None,
220            settings: Vec::new(),
221            rtcp_feedback: Vec::new(),
222        }
223    }
224
225    #[must_use]
226    pub fn with_payload_type(mut self, payload_type: PayloadType) -> Self {
227        self.payload_type = Some(payload_type);
228        self
229    }
230
231    #[must_use]
232    pub fn with_channels(mut self, channels: u16) -> Self {
233        self.channels = Some(channels);
234        self
235    }
236
237    #[must_use]
238    pub fn with_setting(mut self, setting: CodecSetting) -> Self {
239        self.settings.push(setting);
240        self
241    }
242
243    /// An invalid RTX `apt` remains in [`Self::parameters`] while
244    /// [`Self::rtx_associated_payload_type`] returns `None`.
245    #[must_use]
246    pub fn with_parameter(self, name: impl Into<String>, value: impl Into<String>) -> Self {
247        let setting = codec_setting_from_wire(&self.codec, name.into(), value.into());
248        self.with_setting(setting)
249    }
250
251    #[must_use]
252    pub fn with_rtcp_feedback(mut self, feedback: RtcpFeedback) -> Self {
253        self.rtcp_feedback.push(feedback);
254        self
255    }
256
257    #[must_use]
258    pub fn media_kind(&self) -> MediaKind {
259        self.media_kind
260    }
261
262    #[must_use]
263    pub fn codec(&self) -> &MediaCodec {
264        &self.codec
265    }
266
267    #[must_use]
268    pub fn codec_name(&self) -> &str {
269        self.codec.as_str()
270    }
271
272    #[must_use]
273    pub fn clock_rate(&self) -> u32 {
274        self.clock_rate
275    }
276
277    #[must_use]
278    pub fn payload_type_id(&self) -> Option<PayloadType> {
279        self.payload_type
280    }
281
282    #[must_use]
283    pub fn payload_type(&self) -> Option<u8> {
284        self.payload_type.map(PayloadType::value)
285    }
286
287    #[must_use]
288    pub fn channels(&self) -> Option<u16> {
289        self.channels
290    }
291
292    pub fn settings(&self) -> impl Iterator<Item = &CodecSetting> {
293        self.settings.iter()
294    }
295
296    pub fn parameters(&self) -> impl Iterator<Item = (String, String)> + '_ {
297        self.settings
298            .iter()
299            .map(|setting| (setting.key().to_owned(), setting.wire_value().into_owned()))
300    }
301
302    pub fn rtcp_feedback(&self) -> impl Iterator<Item = &RtcpFeedback> {
303        self.rtcp_feedback.iter()
304    }
305
306    #[must_use]
307    pub fn rtx_associated_payload_type_id(&self) -> Option<PayloadType> {
308        self.settings.iter().find_map(|setting| match setting {
309            CodecSetting::RtxAssociation(payload_type) => Some(*payload_type),
310            _ => None,
311        })
312    }
313
314    #[must_use]
315    pub fn rtx_associated_payload_type(&self) -> Option<u8> {
316        self.rtx_associated_payload_type_id()
317            .map(PayloadType::value)
318    }
319}
320
321/// Full set of codec and extension capabilities for an RTP endpoint.
322#[derive(Debug, Clone, Default, PartialEq, Eq)]
323pub struct MediaCapabilities {
324    codecs: Vec<MediaCodecCapability>,
325    header_extensions: Vec<HeaderExtension>,
326}
327
328impl MediaCapabilities {
329    #[must_use]
330    pub fn new(codecs: Vec<MediaCodecCapability>, header_extensions: Vec<HeaderExtension>) -> Self {
331        Self {
332            codecs,
333            header_extensions,
334        }
335    }
336
337    pub fn codecs(&self) -> impl Iterator<Item = &MediaCodecCapability> {
338        self.codecs.iter()
339    }
340
341    pub fn header_extensions(&self) -> impl Iterator<Item = &HeaderExtension> {
342        self.header_extensions.iter()
343    }
344}
345
346/// Negotiated codec format for a concrete media stream.
347///
348/// Unlike a capability, a format has a fixed `payload_type` that matches the
349/// actual value expected in the RTP packets on the wire.
350#[derive(Debug, Clone, PartialEq, Eq)]
351pub struct MediaFormat {
352    media_kind: MediaKind,
353    codec: MediaCodec,
354    payload_type: PayloadType,
355    clock_rate: u32,
356    channels: Option<u16>,
357    settings: Vec<CodecSetting>,
358    rtcp_feedback: Vec<RtcpFeedback>,
359}
360
361impl MediaFormat {
362    #[must_use]
363    pub fn new(
364        media_kind: MediaKind,
365        codec: impl Into<MediaCodec>,
366        payload_type: PayloadType,
367        clock_rate: u32,
368    ) -> Self {
369        Self {
370            media_kind,
371            codec: codec.into(),
372            payload_type,
373            clock_rate,
374            channels: None,
375            settings: Vec::new(),
376            rtcp_feedback: Vec::new(),
377        }
378    }
379
380    #[must_use]
381    pub fn with_channels(mut self, channels: u16) -> Self {
382        self.channels = Some(channels);
383        self
384    }
385
386    #[must_use]
387    pub fn with_setting(mut self, setting: CodecSetting) -> Self {
388        self.settings.push(setting);
389        self
390    }
391
392    #[must_use]
393    pub fn with_parameter(self, name: impl Into<String>, value: impl Into<String>) -> Self {
394        let setting = codec_setting_from_wire(&self.codec, name.into(), value.into());
395        self.with_setting(setting)
396    }
397
398    #[must_use]
399    pub fn with_rtcp_feedback(mut self, feedback: RtcpFeedback) -> Self {
400        self.rtcp_feedback.push(feedback);
401        self
402    }
403
404    #[must_use]
405    pub fn media_kind(&self) -> MediaKind {
406        self.media_kind
407    }
408
409    #[must_use]
410    pub fn codec(&self) -> &MediaCodec {
411        &self.codec
412    }
413
414    #[must_use]
415    pub fn codec_name(&self) -> &str {
416        self.codec.as_str()
417    }
418
419    #[must_use]
420    pub fn payload_type_id(&self) -> PayloadType {
421        self.payload_type
422    }
423
424    #[must_use]
425    pub fn payload_type(&self) -> u8 {
426        self.payload_type.value()
427    }
428
429    #[must_use]
430    pub fn clock_rate(&self) -> u32 {
431        self.clock_rate
432    }
433
434    #[must_use]
435    pub fn channels(&self) -> Option<u16> {
436        self.channels
437    }
438
439    pub fn settings(&self) -> impl Iterator<Item = &CodecSetting> {
440        self.settings.iter()
441    }
442
443    pub fn parameters(&self) -> impl Iterator<Item = (String, String)> + '_ {
444        self.settings
445            .iter()
446            .map(|setting| (setting.key().to_owned(), setting.wire_value().into_owned()))
447    }
448
449    pub fn rtcp_feedback(&self) -> impl Iterator<Item = &RtcpFeedback> {
450        self.rtcp_feedback.iter()
451    }
452
453    #[must_use]
454    pub fn rtx_associated_payload_type_id(&self) -> Option<PayloadType> {
455        self.settings.iter().find_map(|setting| match setting {
456            CodecSetting::RtxAssociation(payload_type) => Some(*payload_type),
457            _ => None,
458        })
459    }
460
461    #[must_use]
462    pub fn rtx_associated_payload_type(&self) -> Option<u8> {
463        self.rtx_associated_payload_type_id()
464            .map(PayloadType::value)
465    }
466}
467
468/// Routing bridge between a negotiated media format and a physical stream.
469///
470/// Ties logical codec formats to the physical multiplexing identifiers (primary SSRC,
471/// repair SSRC, or simulcast RID) resolved from RTP packet headers and SDP.
472///
473/// ```text
474/// Wire RTP Packet Multiplexing:
475///   Primary Stream:  [ RTP Header: SSRC 1000 ] ------------+
476///                                                          |
477///   RTX Repair:      [ RTP Header: SSRC 1001 ] (FID/RRID)  +--> StreamBinding
478///                                                          |    - SSRC: 1000
479///   Simulcast Layer: [ Header Ext: RID "h"   ] ------------+    - Repair SSRC: 1001
480///                                                               - RID: "h"
481///                                                               - PayloadType: 96
482/// ```
483///
484/// FID supplies `repair_ssrc`. RID and repaired RID associate packets through `rid`.
485///
486/// References:
487/// - RFC 4588 section 5 (RTX source association): <https://www.rfc-editor.org/rfc/rfc4588.html#section-5>
488/// - RFC 5576 section 4.2 (SDP FID grouping): <https://www.rfc-editor.org/rfc/rfc5576.html#section-4.2>
489/// - RFC 8852 section 3.3 (RID-based repair): <https://www.rfc-editor.org/rfc/rfc8852.html#section-3.3>
490#[derive(Debug, Clone, Default, PartialEq, Eq)]
491pub struct StreamBinding {
492    ssrc: Option<Ssrc>,
493    repair_ssrc: Option<Ssrc>,
494    rid: Option<Rid>,
495    payload_type: Option<PayloadType>,
496    max_bitrate: Option<u64>,
497}
498
499impl StreamBinding {
500    #[must_use]
501    pub fn new() -> Self {
502        Self::default()
503    }
504
505    #[must_use]
506    pub fn with_ssrc(mut self, ssrc: impl Into<Ssrc>) -> Self {
507        self.ssrc = Some(ssrc.into());
508        self
509    }
510
511    /// Associates an RTX source with its primary per
512    /// <https://www.rfc-editor.org/rfc/rfc4588.html#section-5> and the FID form
513    /// in <https://www.rfc-editor.org/rfc/rfc5576.html#section-4.2>.
514    #[must_use]
515    pub fn with_repair_ssrc(mut self, repair_ssrc: impl Into<Ssrc>) -> Self {
516        self.repair_ssrc = Some(repair_ssrc.into());
517        self
518    }
519
520    #[must_use]
521    pub fn with_rid(mut self, rid: impl Into<Rid>) -> Self {
522        self.rid = Some(rid.into());
523        self
524    }
525
526    #[must_use]
527    pub fn with_payload_type(mut self, payload_type: PayloadType) -> Self {
528        self.payload_type = Some(payload_type);
529        self
530    }
531
532    #[must_use]
533    pub fn with_max_bitrate(mut self, max_bitrate: u64) -> Self {
534        self.max_bitrate = Some(max_bitrate);
535        self
536    }
537
538    #[must_use]
539    pub fn ssrc(&self) -> Option<u32> {
540        self.ssrc.map(Ssrc::value)
541    }
542
543    #[must_use]
544    pub fn repair_ssrc(&self) -> Option<u32> {
545        self.repair_ssrc.map(Ssrc::value)
546    }
547
548    #[must_use]
549    pub fn rid(&self) -> Option<&str> {
550        self.rid.as_ref().map(Rid::as_str)
551    }
552
553    #[must_use]
554    pub(super) fn with_payload_type_mapping(
555        mut self,
556        payload_types: &[(PayloadType, PayloadType)],
557    ) -> Self {
558        if let Some(payload_type) = self.payload_type {
559            let mapped_payload_type = payload_types
560                .iter()
561                .find_map(|(original, mapped)| (*original == payload_type).then_some(*mapped))
562                .unwrap_or(payload_type);
563            self.payload_type = Some(mapped_payload_type);
564        }
565        self
566    }
567
568    #[must_use]
569    pub fn payload_type_id(&self) -> Option<PayloadType> {
570        self.payload_type
571    }
572
573    #[must_use]
574    pub fn payload_type(&self) -> Option<u8> {
575        self.payload_type.map(PayloadType::value)
576    }
577
578    #[must_use]
579    pub fn max_bitrate(&self) -> Option<u64> {
580        self.max_bitrate
581    }
582}
583
584/// Description of one logical media stream (e.g. "camera") at the router boundary.
585///
586/// Combines negotiated formats (codecs), extensions, and the stream bindings
587/// that tell the router how to identify the packets on the wire.
588#[derive(Debug, Clone, Default, PartialEq, Eq)]
589pub struct MediaStream {
590    formats: Vec<MediaFormat>,
591    header_extensions: Vec<HeaderExtension>,
592    bindings: Vec<StreamBinding>,
593    mid: Option<Mid>,
594}
595
596impl MediaStream {
597    #[must_use]
598    pub fn new(
599        formats: Vec<MediaFormat>,
600        header_extensions: Vec<HeaderExtension>,
601        bindings: Vec<StreamBinding>,
602    ) -> Self {
603        Self {
604            formats,
605            header_extensions,
606            bindings,
607            mid: None,
608        }
609    }
610
611    #[must_use]
612    pub fn with_mid(mut self, mid: impl Into<Mid>) -> Self {
613        self.mid = Some(mid.into());
614        self
615    }
616
617    pub fn formats(&self) -> impl Iterator<Item = &MediaFormat> {
618        self.formats.iter()
619    }
620
621    pub fn header_extensions(&self) -> impl Iterator<Item = &HeaderExtension> {
622        self.header_extensions.iter()
623    }
624
625    pub fn bindings(&self) -> impl Iterator<Item = &StreamBinding> {
626        self.bindings.iter()
627    }
628
629    #[must_use]
630    pub fn mid(&self) -> Option<&str> {
631        self.mid.as_ref().map(Mid::as_str)
632    }
633}
634
635fn codec_setting_from_wire(codec: &MediaCodec, key: String, value: String) -> CodecSetting {
636    match key.as_str() {
637        rfc_rtp::fmtp::RTX_ASSOCIATION => value
638            .parse::<u8>()
639            .ok()
640            .and_then(PayloadType::try_new)
641            .map_or(
642                CodecSetting::Other { key, value },
643                CodecSetting::RtxAssociation,
644            ),
645        rfc_rtp::fmtp::H264_PACKETIZATION_MODE => value
646            .parse::<u8>()
647            .ok()
648            .and_then(rfc_rtp::h264::PacketizationMode::from_fmtp_value)
649            .map_or_else(
650                || CodecSetting::Other { key, value },
651                CodecSetting::H264PacketizationMode,
652            ),
653        rfc_rtp::fmtp::H264_PROFILE_LEVEL_ID => CodecSetting::H264ProfileLevelId(value),
654        rfc_rtp::fmtp::VP9_PROFILE_ID if codec == &MediaCodec::Vp9 => value
655            .parse::<u8>()
656            .ok()
657            .and_then(rfc_rtp::Vp9ProfileId::try_new)
658            .map_or(
659                CodecSetting::Other { key, value },
660                CodecSetting::Vp9ProfileId,
661            ),
662        rfc_rtp::fmtp::OPUS_USE_IN_BAND_FEC => match value.as_str() {
663            rfc_rtp::fmtp::VALUE_ENABLED | rfc_rtp::fmtp::VALUE_TRUE => {
664                CodecSetting::UseInBandFec(true)
665            }
666            rfc_rtp::fmtp::VALUE_DISABLED | rfc_rtp::fmtp::VALUE_FALSE => {
667                CodecSetting::UseInBandFec(false)
668            }
669            _ => CodecSetting::Other { key, value },
670        },
671        _ => CodecSetting::Other { key, value },
672    }
673}