Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Remove audio_remb
Browse files Browse the repository at this point in the history
  • Loading branch information
feymartynov committed Mar 30, 2021
1 parent 256bd96 commit 05c2c33
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 91 deletions.
1 change: 0 additions & 1 deletion docs/src/api/agent_writer_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ agent_id | agent_id | _required_ | Writer identifier which the config applies
send_video | bool | true | Whether the writer is allowed to publish video.
send_audio | bool | true | Whether the writer is allowed to publish audio.
video_remb | int | _required_ | Maximum video bitrate requested for the writer.
audio_remb | int | _required_ | Maximum audio bitrate requested for the writer.
3 changes: 1 addition & 2 deletions migrations/2021-03-18-234004_create_rtc_rw_configs/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ CREATE TABLE rtc_writer_config (
rtc_id UUID NOT NULL,
send_video BOOLEAN NOT NULL,
send_audio BOOLEAN NOT NULL,
audio_remb BIGINT CHECK (video_remb IS NULL OR video_remb > 0),
video_remb BIGINT CHECK (audio_remb IS NULL OR audio_remb > 0),
video_remb BIGINT CHECK (video_remb IS NULL OR video_remb > 0),

FOREIGN KEY (rtc_id) REFERENCES rtc (id) ON DELETE CASCADE,
PRIMARY KEY (rtc_id)
Expand Down
41 changes: 0 additions & 41 deletions src/app/endpoint/agent_writer_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ impl State {
config_item = config_item.video_remb(video_remb as u32);
}

if let Some(audio_remb) = rtc_writer_config.audio_remb() {
config_item = config_item.audio_remb(audio_remb as u32);
}

config_item
})
.collect::<Vec<_>>();
Expand All @@ -57,7 +53,6 @@ pub(crate) struct StateConfigItem {
send_video: Option<bool>,
send_audio: Option<bool>,
video_remb: Option<u32>,
audio_remb: Option<u32>,
}

impl StateConfigItem {
Expand All @@ -67,7 +62,6 @@ impl StateConfigItem {
send_video: None,
send_audio: None,
video_remb: None,
audio_remb: None,
}
}

Expand All @@ -91,13 +85,6 @@ impl StateConfigItem {
..self
}
}

fn audio_remb(self, audio_remb: u32) -> Self {
Self {
audio_remb: Some(audio_remb),
..self
}
}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -184,10 +171,6 @@ impl RequestHandler for UpdateHandler {
q = q.video_remb(video_remb.into());
}

if let Some(audio_remb) = state_config_item.audio_remb {
q = q.audio_remb(audio_remb.into());
}

q.execute(&conn)?;
}

Expand Down Expand Up @@ -372,14 +355,12 @@ mod tests {
send_video: Some(true),
send_audio: Some(false),
video_remb: Some(300_000),
audio_remb: Some(60_000),
},
StateConfigItem {
agent_id: agent3.agent_id().to_owned(),
send_video: Some(false),
send_audio: Some(false),
video_remb: None,
audio_remb: None,
},
],
};
Expand All @@ -403,7 +384,6 @@ mod tests {
assert_eq!(agent2_config.send_video, Some(true));
assert_eq!(agent2_config.send_audio, Some(false));
assert_eq!(agent2_config.video_remb, Some(300_000));
assert_eq!(agent2_config.audio_remb, Some(60_000));

let agent3_config = state
.configs
Expand All @@ -414,7 +394,6 @@ mod tests {
assert_eq!(agent3_config.send_video, Some(false));
assert_eq!(agent3_config.send_audio, Some(false));
assert_eq!(agent3_config.video_remb, None);
assert_eq!(agent3_config.audio_remb, None);

// Assert notification.
let (state, evp, _) = find_event::<State>(messages.as_slice());
Expand All @@ -431,7 +410,6 @@ mod tests {
assert_eq!(agent2_config.send_video, Some(true));
assert_eq!(agent2_config.send_audio, Some(false));
assert_eq!(agent2_config.video_remb, Some(300_000));
assert_eq!(agent2_config.audio_remb, Some(60_000));

let agent3_config = state
.configs
Expand All @@ -442,7 +420,6 @@ mod tests {
assert_eq!(agent3_config.send_video, Some(false));
assert_eq!(agent3_config.send_audio, Some(false));
assert_eq!(agent3_config.video_remb, None);
assert_eq!(agent3_config.audio_remb, None);

// Assert backend request.
let (req, _reqp, topic) =
Expand Down Expand Up @@ -472,7 +449,6 @@ mod tests {
assert_eq!(agent2_config.send_video(), true);
assert_eq!(agent2_config.send_audio(), false);
assert_eq!(agent2_config.video_remb(), Some(300_000));
assert_eq!(agent2_config.audio_remb(), Some(60_000));

let agent3_config = configs
.iter()
Expand All @@ -482,7 +458,6 @@ mod tests {
assert_eq!(agent3_config.send_video(), false);
assert_eq!(agent3_config.send_audio(), false);
assert_eq!(agent3_config.video_remb(), None);
assert_eq!(agent3_config.audio_remb(), None);

// Make one more agent_writer_config.update request.
let payload = State {
Expand All @@ -493,14 +468,12 @@ mod tests {
send_video: Some(true),
send_audio: Some(true),
video_remb: Some(1_000_000),
audio_remb: Some(60_000),
},
StateConfigItem {
agent_id: agent3.agent_id().to_owned(),
send_video: None,
send_audio: Some(true),
video_remb: None,
audio_remb: Some(30_000),
},
],
};
Expand All @@ -524,7 +497,6 @@ mod tests {
assert_eq!(agent2_config.send_video, Some(true));
assert_eq!(agent2_config.send_audio, Some(false));
assert_eq!(agent2_config.video_remb, Some(300_000));
assert_eq!(agent2_config.audio_remb, Some(60_000));

let agent3_config = state
.configs
Expand All @@ -535,7 +507,6 @@ mod tests {
assert_eq!(agent3_config.send_video, Some(false));
assert_eq!(agent3_config.send_audio, Some(true));
assert_eq!(agent3_config.video_remb, None);
assert_eq!(agent3_config.audio_remb, Some(30_000));

let agent4_config = state
.configs
Expand All @@ -546,7 +517,6 @@ mod tests {
assert_eq!(agent4_config.send_video, Some(true));
assert_eq!(agent4_config.send_audio, Some(true));
assert_eq!(agent4_config.video_remb, Some(1_000_000));
assert_eq!(agent4_config.audio_remb, Some(60_000));

// Assert notification.
let (state, evp, _) = find_event::<State>(messages.as_slice());
Expand All @@ -563,7 +533,6 @@ mod tests {
assert_eq!(agent2_config.send_video, Some(true));
assert_eq!(agent2_config.send_audio, Some(false));
assert_eq!(agent2_config.video_remb, Some(300_000));
assert_eq!(agent2_config.audio_remb, Some(60_000));

let agent3_config = state
.configs
Expand All @@ -574,7 +543,6 @@ mod tests {
assert_eq!(agent3_config.send_video, Some(false));
assert_eq!(agent3_config.send_audio, Some(true));
assert_eq!(agent3_config.video_remb, None);
assert_eq!(agent3_config.audio_remb, Some(30_000));

let agent4_config = state
.configs
Expand All @@ -585,7 +553,6 @@ mod tests {
assert_eq!(agent4_config.send_video, Some(true));
assert_eq!(agent4_config.send_audio, Some(true));
assert_eq!(agent4_config.video_remb, Some(1_000_000));
assert_eq!(agent4_config.audio_remb, Some(60_000));

// Assert backend request.
let (req, _reqp, topic) =
Expand Down Expand Up @@ -615,7 +582,6 @@ mod tests {
assert_eq!(agent2_config.send_video(), true);
assert_eq!(agent2_config.send_audio(), false);
assert_eq!(agent2_config.video_remb(), Some(300_000));
assert_eq!(agent2_config.audio_remb(), Some(60_000));

let agent3_config = configs
.iter()
Expand All @@ -625,7 +591,6 @@ mod tests {
assert_eq!(agent3_config.send_video(), false);
assert_eq!(agent3_config.send_audio(), true);
assert_eq!(agent3_config.video_remb(), None);
assert_eq!(agent3_config.audio_remb(), Some(30_000));

let agent4_config = configs
.iter()
Expand All @@ -635,7 +600,6 @@ mod tests {
assert_eq!(agent4_config.send_video(), true);
assert_eq!(agent4_config.send_audio(), true);
assert_eq!(agent4_config.video_remb(), Some(1_000_000));
assert_eq!(agent4_config.audio_remb(), Some(60_000));
Ok(())
}

Expand Down Expand Up @@ -692,7 +656,6 @@ mod tests {
send_video: Some(false),
send_audio: Some(true),
video_remb: Some(300_000),
audio_remb: Some(60_000),
}
})
.collect::<Vec<_>>();
Expand Down Expand Up @@ -884,7 +847,6 @@ mod tests {
.send_video(true)
.send_audio(true)
.video_remb(1_000_000)
.audio_remb(60_000)
.insert(&conn);

let rtc3 = factory::Rtc::new(room.id())
Expand All @@ -895,7 +857,6 @@ mod tests {
.send_video(false)
.send_audio(false)
.video_remb(300_000)
.audio_remb(50_000)
.insert(&conn);

room
Expand Down Expand Up @@ -926,7 +887,6 @@ mod tests {
assert_eq!(agent2_config.send_video, Some(true));
assert_eq!(agent2_config.send_audio, Some(true));
assert_eq!(agent2_config.video_remb, Some(1_000_000));
assert_eq!(agent2_config.audio_remb, Some(60_000));

let agent3_config = state
.configs
Expand All @@ -937,7 +897,6 @@ mod tests {
assert_eq!(agent3_config.send_video, Some(false));
assert_eq!(agent3_config.send_audio, Some(false));
assert_eq!(agent3_config.video_remb, Some(300_000));
assert_eq!(agent3_config.audio_remb, Some(50_000));

Ok(())
}
Expand Down
13 changes: 0 additions & 13 deletions src/backend/janus/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,6 @@ pub(crate) struct UpdateWriterConfigRequestBodyConfigItem {
send_audio: bool,
#[serde(skip_serializing_if = "Option::is_none")]
video_remb: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
audio_remb: Option<u32>,
}

impl UpdateWriterConfigRequestBodyConfigItem {
Expand All @@ -311,7 +309,6 @@ impl UpdateWriterConfigRequestBodyConfigItem {
send_video,
send_audio,
video_remb: None,
audio_remb: None,
}
}

Expand All @@ -320,11 +317,6 @@ impl UpdateWriterConfigRequestBodyConfigItem {
self
}

pub(crate) fn set_audio_remb(&mut self, audio_remb: u32) -> &mut Self {
self.audio_remb = Some(audio_remb);
self
}

#[cfg(test)]
pub(crate) fn stream_id(&self) -> Uuid {
self.stream_id
Expand All @@ -344,9 +336,4 @@ impl UpdateWriterConfigRequestBodyConfigItem {
pub(crate) fn video_remb(&self) -> Option<u32> {
self.video_remb
}

#[cfg(test)]
pub(crate) fn audio_remb(&self) -> Option<u32> {
self.audio_remb
}
}
4 changes: 0 additions & 4 deletions src/backend/janus/transactions/update_agent_writer_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ impl Client {
req.set_video_remb(video_remb as u32);
}

if let Some(audio_remb) = rtc_writer_config.audio_remb() {
req.set_audio_remb(audio_remb as u32);
}

req
})
.collect::<Vec<UpdateWriterConfigRequestBodyConfigItem>>();
Expand Down
16 changes: 0 additions & 16 deletions src/db/rtc_writer_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ type AllColumns = (
rtc_writer_config::send_video,
rtc_writer_config::send_audio,
rtc_writer_config::video_remb,
rtc_writer_config::audio_remb,
);

const ALL_COLUMNS: AllColumns = (
rtc_writer_config::rtc_id,
rtc_writer_config::send_video,
rtc_writer_config::send_audio,
rtc_writer_config::video_remb,
rtc_writer_config::audio_remb,
);

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -33,7 +31,6 @@ pub(crate) struct Object {
send_video: bool,
send_audio: bool,
video_remb: Option<i64>,
audio_remb: Option<i64>,
}

impl Object {
Expand All @@ -48,10 +45,6 @@ impl Object {
pub(crate) fn video_remb(&self) -> Option<i64> {
self.video_remb
}

pub(crate) fn audio_remb(&self) -> Option<i64> {
self.audio_remb
}
}

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -86,7 +79,6 @@ pub(crate) struct UpsertQuery {
send_video: Option<bool>,
send_audio: Option<bool>,
video_remb: Option<i64>,
audio_remb: Option<i64>,
}

impl UpsertQuery {
Expand All @@ -96,7 +88,6 @@ impl UpsertQuery {
send_video: None,
send_audio: None,
video_remb: None,
audio_remb: None,
}
}

Expand All @@ -121,13 +112,6 @@ impl UpsertQuery {
}
}

pub(crate) fn audio_remb(self, audio_remb: i64) -> Self {
Self {
audio_remb: Some(audio_remb),
..self
}
}

pub(crate) fn execute(&self, conn: &PgConnection) -> Result<Object, Error> {
use diesel::prelude::*;

Expand Down
1 change: 0 additions & 1 deletion src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ table! {
rtc_id -> Uuid,
send_video -> Bool,
send_audio -> Bool,
audio_remb -> Nullable<Int8>,
video_remb -> Nullable<Int8>,
}
}
Expand Down
Loading

0 comments on commit 05c2c33

Please sign in to comment.