Skip to content

Commit

Permalink
enhance scalability_mode parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmillan committed Oct 25, 2023
1 parent 2487856 commit 7c28fbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions rust/src/ortc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ impl RtpMapping {
ssrc: mapping?.ssrc()?,
scalability_mode: mapping?
.scalability_mode()?
.unwrap_or(String::from("S1T1").as_str())
.parse()?,
.map(|maybe_scalability_mode| maybe_scalability_mode.parse())
.transpose()?
.unwrap_or_default(),
mapped_ssrc: mapping?.mapped_ssrc()?,
})
})
Expand Down
4 changes: 2 additions & 2 deletions rust/src/worker/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ enum ChannelReceiveMessage<'a> {
}

// Remove the first 4 bytes which represent the buffer size.
// NOTE: This is only needed for NodeJS.
// NOTE: The prefix is only needed for NodeJS.
fn unprefix_message(bytes: &[u8]) -> &[u8] {
&bytes[4..]
}

fn deserialize_message(bytes: &[u8]) -> ChannelReceiveMessage<'_> {
let message_ref = message::MessageRef::read_as_root(&bytes).unwrap();
let message_ref = message::MessageRef::read_as_root(bytes).unwrap();

match message_ref.data().unwrap() {
message::BodyRef::Log(data) => match data.data().unwrap().chars().next() {
Expand Down

0 comments on commit 7c28fbc

Please sign in to comment.