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

Commit

Permalink
Pin exact audio and video codecs + set params for h264 codec
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Shlagoff committed Jan 11, 2019
1 parent 0ba87ee commit e64f2ce
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,22 @@ fn handle_jsep(
let offer = sdp::Sdp::parse(&CString::new(sdp)?)?;
janus_verb!("[CONFERENCE] offer: {:?}", offer);

let answer = answer_sdp!(offer);
let mut answer = answer_sdp!(
offer,
sdp::OfferAnswerParameters::AudioCodec,
sdp::AudioCodec::Opus.to_cstr().as_ptr(),
sdp::OfferAnswerParameters::VideoCodec,
sdp::VideoCodec::H264.to_cstr().as_ptr()
);
let video_payload_type = answer.get_payload_type(sdp::VideoCodec::H264.to_cstr());
if let Some(pt) = video_payload_type {
let settings = CString::new(format!(
"{} profile-level-id=42e01f; packetization-mode=1",
pt
))?;
answer.add_attribute(pt, c_str!("fmtp"), &settings);
}

janus_verb!("[CONFERENCE] answer: {:?}", answer);

let answer = answer.to_glibstring().to_string_lossy().to_string();
Expand Down

0 comments on commit e64f2ce

Please sign in to comment.