rsfu/sfu/
simulcast.rs

1use serde::Deserialize;
2use std::time::SystemTime;
3
4pub const QUARTER_RESOLUTION: &str = "q";
5pub const HALF_RESOLUTION: &str = "h";
6pub const FULL_RESOLUTION: &str = "f";
7#[derive(Default, Clone, Deserialize)]
8pub struct SimulcastConfig {
9    #[serde(rename = "bestqualityfirst")]
10    pub best_quality_first: bool,
11    #[allow(dead_code)]
12    #[serde(rename = "enabletemporallayer")]
13    enable_temporal_layer: bool,
14}
15
16pub struct SimulcastTrackHelpers {
17    pub switch_delay: SystemTime,
18    pub temporal_supported: bool,
19    #[allow(dead_code)]
20    temporal_enabled: bool,
21    pub l_ts_calc: i64,
22
23    pub p_ref_pic_id: u16,
24    pub ref_pic_id: u16,
25    pub l_pic_id: u16,
26    pub p_ref_tlz_idx: u8,
27    pub ref_tlz_idx: u8,
28    pub l_tlz_idx: u8,
29    pub ref_sn: u16,
30}
31
32impl SimulcastTrackHelpers {
33    pub fn new() -> Self {
34        Self {
35            switch_delay: SystemTime::now(),
36            temporal_supported: false,
37            temporal_enabled: false,
38            l_ts_calc: 0,
39
40            p_ref_pic_id: 0,
41            ref_pic_id: 0,
42            l_pic_id: 0,
43            p_ref_tlz_idx: 0,
44            ref_tlz_idx: 0,
45            l_tlz_idx: 0,
46            ref_sn: 0,
47        }
48    }
49}