diff --git a/Cargo.lock b/Cargo.lock index 85189d3..802b3c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,19 +83,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "jansson-sys" version = "0.1.0" -source = "git+https://github.com/mozilla/janus-plugin-rs#d3fba6066e6dfa01412de112a10d1a194a6cf851" +source = "git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15#d4149c761a1089ac1dbbce851b2b5f906796dfff" [[package]] name = "janus-plugin" version = "0.12.0" -source = "git+https://github.com/mozilla/janus-plugin-rs#d3fba6066e6dfa01412de112a10d1a194a6cf851" +source = "git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15#d4149c761a1089ac1dbbce851b2b5f906796dfff" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "colored 1.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "glib-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jansson-sys 0.1.0 (git+https://github.com/mozilla/janus-plugin-rs)", - "janus-plugin-sys 0.7.0 (git+https://github.com/mozilla/janus-plugin-rs)", + "jansson-sys 0.1.0 (git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15)", + "janus-plugin-sys 0.7.0 (git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15)", "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.105 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -104,7 +104,7 @@ dependencies = [ name = "janus-plugin-sfu" version = "0.1.0" dependencies = [ - "janus-plugin 0.12.0 (git+https://github.com/mozilla/janus-plugin-rs)", + "janus-plugin 0.12.0 (git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15)", "jsonwebtoken 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "multimap 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -118,10 +118,10 @@ dependencies = [ [[package]] name = "janus-plugin-sys" version = "0.7.0" -source = "git+https://github.com/mozilla/janus-plugin-rs#d3fba6066e6dfa01412de112a10d1a194a6cf851" +source = "git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15#d4149c761a1089ac1dbbce851b2b5f906796dfff" dependencies = [ "glib-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jansson-sys 0.1.0 (git+https://github.com/mozilla/janus-plugin-rs)", + "jansson-sys 0.1.0 (git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15)", ] [[package]] @@ -330,9 +330,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum glib-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "95856f3802f446c05feffa5e24859fe6a183a7cb849c8449afc35c86b1e316e2" "checksum hermit-abi 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" "checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" -"checksum jansson-sys 0.1.0 (git+https://github.com/mozilla/janus-plugin-rs)" = "" -"checksum janus-plugin 0.12.0 (git+https://github.com/mozilla/janus-plugin-rs)" = "" -"checksum janus-plugin-sys 0.7.0 (git+https://github.com/mozilla/janus-plugin-rs)" = "" +"checksum jansson-sys 0.1.0 (git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15)" = "" +"checksum janus-plugin 0.12.0 (git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15)" = "" +"checksum janus-plugin-sys 0.7.0 (git+https://github.com/Synantoo/janus-plugin-rs?branch=feature/api-v15)" = "" "checksum jsonwebtoken 6.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a81d1812d731546d2614737bee92aa071d37e9afa1409bc374da9e5e70e70b22" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" diff --git a/Cargo.toml b/Cargo.toml index 9656793..f2f3188 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ crate_type = ["cdylib"] lto = true [dependencies] -janus-plugin = { git = "https://github.com/mozilla/janus-plugin-rs" } +janus-plugin = "0.12" multimap = "0.8" once_cell = "1.2" serde = { version = "1.0", features = ["derive"] } @@ -25,3 +25,7 @@ rust-ini = "0.13" jsonwebtoken = "6.0" lazy_static = "1.4.0" num_cpus = "1.12.0" + +[patch.crates-io] +janus-plugin-sys = { git = "https://github.com/Synantoo/janus-plugin-rs", branch = "feature/api-v15" } +janus-plugin = { git = "https://github.com/Synantoo/janus-plugin-rs", branch = "feature/api-v15" } diff --git a/src/lib.rs b/src/lib.rs index 867e198..9b862fb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -388,6 +388,10 @@ extern "C" fn incoming_data(handle: *mut PluginSession, packet: *mut PluginDataP } } +extern "C" fn data_ready(_handle: *mut PluginSession) { + // Skip data channels. +} + extern "C" fn slow_link(handle: *mut PluginSession, _uplink: c_int, _video: c_int) { let sess = unsafe { Session::from_ptr(handle).expect("Session can't be null!") }; janus_info!("Slow link message received on {:p}.", sess.handle); @@ -606,6 +610,7 @@ fn process_message(from: &Arc, msg: MessageKind) -> MessageResult { fn process_offer(from: &Session, offer: &Sdp) -> JsepResult { // enforce publication of the codecs that we know our client base will be compatible with janus_info!("Processing JSEP offer from {:p}: {:?}", from.handle, offer); + let h264_profile = c_str!("42e01f"); let mut answer = answer_sdp!( offer, OfferAnswerParameters::AudioCodec, @@ -614,11 +619,13 @@ fn process_offer(from: &Session, offer: &Sdp) -> JsepResult { MediaDirection::JANUS_SDP_RECVONLY, OfferAnswerParameters::VideoCodec, VIDEO_CODEC.to_cstr().as_ptr(), + OfferAnswerParameters::H264Profile, + h264_profile.as_ptr(), OfferAnswerParameters::VideoDirection, MediaDirection::JANUS_SDP_RECVONLY, ); let audio_payload_type = answer.get_payload_type(AUDIO_CODEC.to_cstr()); - let video_payload_type = answer.get_payload_type(VIDEO_CODEC.to_cstr()); + let video_payload_type = answer.get_payload_type_full(VIDEO_CODEC.to_cstr(), h264_profile); if let Some(pt) = audio_payload_type { // todo: figure out some more principled way to keep track of this stuff per room let settings = CString::new(format!("{} stereo=0; sprop-stereo=0; usedtx=1;", pt))?; @@ -651,6 +658,8 @@ fn process_offer(from: &Session, offer: &Sdp) -> JsepResult { VIDEO_CODEC.to_cstr().as_ptr(), OfferAnswerParameters::VideoPayloadType, video_payload_type.unwrap_or(100), + OfferAnswerParameters::H264Profile, + h264_profile.as_ptr(), OfferAnswerParameters::VideoDirection, MediaDirection::JANUS_SDP_SENDONLY, ); @@ -770,7 +779,7 @@ extern "C" fn handle_admin_message(_message: *mut RawJanssonValue) -> *mut RawJa const PLUGIN: Plugin = build_plugin!( LibraryMetadata { - api_version: 14, + api_version: 15, version: 1, name: c_str!("Janus SFU plugin"), package: c_str!("janus.plugin.sfu"), @@ -787,6 +796,7 @@ const PLUGIN: Plugin = build_plugin!( incoming_rtp, incoming_rtcp, incoming_data, + data_ready, slow_link, hangup_media, destroy_session,