Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

More changes related to latest janus 0.10.x #1

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions janus-plugin-sys/src/sdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ extern "C" {
pub fn janus_sdp_generate_offer(name: *const c_char, address: *const c_char, ...) -> *mut janus_sdp;
pub fn janus_sdp_generate_answer(offer: *mut janus_sdp, ...) -> *mut janus_sdp;
pub fn janus_sdp_get_codec_pt(sdp: *mut janus_sdp, codec: *const c_char) -> c_int;
pub fn janus_sdp_get_codec_pt_full(sdp: *mut janus_sdp, codec: *const c_char, profile: *const c_char) -> c_int;
pub fn janus_sdp_get_codec_name(sdp: *mut janus_sdp, pt: c_int) -> *const c_char;
pub fn janus_sdp_get_codec_rtpmap(codec: *const c_char) -> *const c_char;
pub fn janus_sdp_destroy(sdp: *mut janus_sdp);
Expand Down
37 changes: 31 additions & 6 deletions src/sdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ pub enum VideoCodec {
Vp8,
Vp9,
H264,
Av1,
H265,
}

impl VideoCodec {
Expand All @@ -78,6 +80,8 @@ impl VideoCodec {
VideoCodec::Vp8 => c_str!("vp8"),
VideoCodec::Vp9 => c_str!("vp9"),
VideoCodec::H264 => c_str!("h264"),
VideoCodec::Av1 => c_str!("av1"),
VideoCodec::H265 => c_str!("h265"),
}
}
}
Expand All @@ -103,16 +107,27 @@ pub enum OfferAnswerParameters {
AudioCodec = 6,
/// The VideoCodec for the video stream.
VideoCodec = 7,
/// Use this profile for VP9
Vp9Profile = 8,
/// Use this profile for H.264
H264Profile = 9,
/// The payload type for the audio stream.
AudioPayloadType = 8,
AudioPayloadType = 10,
/// The payload type for the video stream.
VideoPayloadType = 9,
VideoPayloadType = 11,
/// Whether to negotiate telephone events.
AudioDtmf = 10,
AudioDtmf = 12,
/// Add a custom fmtp string for audio
AudioFmtp = 13,
/// Add a custom fmtp string for video
/// @note This property is ignored if Vp9Profile or H264Profile is used on a compliant codec.
VideoFmtp = 14,
/// Whether to add RTCP-FB attributes.
VideoRtcpfbDefaults = 11,
/// Whether to add attributes for H.264 video.
VideoH264Fmtp = 12,
VideoRtcpfbDefaults = 15,
DataLegacy = 16,
AudioExtension = 17,
VideoExtension = 18,
AcceptExtmap = 19,
}

/// An SDP session description.
Expand Down Expand Up @@ -166,6 +181,16 @@ impl Sdp {
}
}

/// Gets the payload type number for a codec and provided video profile in this SDP, or None if the codec isn't present with the provided video profile.
pub fn get_payload_type_full(&self, codec_name: &CStr, profile: &CStr) -> Option<i32> {
unsafe {
match ffi::sdp::janus_sdp_get_codec_pt_full(self.ptr, codec_name.as_ptr(), profile.as_ptr()) {
err if err < 0 => None,
n => Some(n),
}
}
}

/// Adds an attribute for the m-line with the given payload type.
pub fn add_attribute(&mut self, pt: i32, name: &CStr, contents: &CStr) {
for (_media, m_lines) in self.get_mlines() {
Expand Down