From 57f78656a348aa5cbd40b7e0ed6042662afa2853 Mon Sep 17 00:00:00 2001 From: Jasper Hugo Date: Sat, 14 Aug 2021 13:04:40 +0700 Subject: [PATCH] compatibility with libnice 0.1.16 --- Cargo.lock | 5 +++- Cargo.toml | 8 +++++- lib-gst-meet/Cargo.toml | 7 ++--- lib-gst-meet/src/jingle.rs | 53 +++++++++++++++----------------------- 4 files changed, 34 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d8be98c..70a8e12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -656,7 +656,6 @@ dependencies = [ "nice-gst-meet", "once_cell", "pem", - "pkg-config", "rand", "rcgen", "ring", @@ -668,6 +667,10 @@ dependencies = [ "xmpp-parsers-gst-meet", ] +[[package]] +name = "lib-gst-meet-c" +version = "0.1.0" + [[package]] name = "libc" version = "0.2.99" diff --git a/Cargo.toml b/Cargo.toml index a774340..e4a728d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,2 +1,8 @@ [workspace] -members = ["lib-gst-meet", "gst-meet", "nice-gst-meet", "nice-gst-meet-sys"] \ No newline at end of file +members = [ + "gst-meet", + "lib-gst-meet", + "lib-gst-meet-c", + "nice-gst-meet", + "nice-gst-meet-sys", +] \ No newline at end of file diff --git a/lib-gst-meet/Cargo.toml b/lib-gst-meet/Cargo.toml index 5ea6dd2..bd54cf0 100644 --- a/lib-gst-meet/Cargo.toml +++ b/lib-gst-meet/Cargo.toml @@ -13,12 +13,12 @@ async-trait = { version = "0.1", default-features = false } bytes = { version = "1", default-features = false, features = ["std"] } futures = { version = "0.3", default-features = false } glib = { version = "0.14", default-features = false } -gstreamer = { version = "0.17", default-features = false, features = ["v1_18"] } +gstreamer = { version = "0.17", default-features = false, features = ["v1_16"] } hex = { version = "0.4", default-features = false, features = ["std"] } itertools = { version = "0.10", default-features = false, features = ["use_std"] } libc = { version = "0.2", default-features = false } maplit = { version = "1", default-features = false } -nice-gst-meet = { version = "0.1", path = "../nice-gst-meet", default-features = false, features = ["v0_1_18"] } +nice-gst-meet = { version = "0.1", path = "../nice-gst-meet", default-features = false, features = ["v0_1_16"] } once_cell = { version = "1", default-features = false, features = ["std"] } pem = { version = "0.8", default-features = false } rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] } @@ -30,6 +30,3 @@ tokio-tungstenite = { version = "0.14", default-features = false, features = ["c tracing = { version = "0.1", default-features = false, features = ["attributes", "std"] } uuid = { version = "0.8", default-features = false, features = ["v4"] } xmpp-parsers = { package = "xmpp-parsers-gst-meet", version = "0.18", default-features = false } - -[build-dependencies] -pkg-config = { version = "0.3", default-features = false } diff --git a/lib-gst-meet/src/jingle.rs b/lib-gst-meet/src/jingle.rs index 66ff975..31e1ed4 100644 --- a/lib-gst-meet/src/jingle.rs +++ b/lib-gst-meet/src/jingle.rs @@ -338,10 +338,6 @@ impl JingleSession { candidate.set_foundation(&c.foundation); candidate.set_addr(SocketAddr::new(c.ip, c.port)); candidate.set_priority(c.priority); - candidate.set_transport(match c.protocol.as_str() { - "udp" => nice::CandidateTransport::Udp, - other => panic!("unsupported protocol: {}", other), - }); candidate.set_username(ufrag); candidate.set_password(pwd); debug!("candidate: {:?}", candidate); @@ -757,35 +753,28 @@ impl JingleSession { transport.pwd = Some(ice_local_pwd.clone()); transport.candidates = vec![]; for c in &local_candidates { - match c.transport() { - nice::CandidateTransport::Udp => { - let addr = c.addr(); - let foundation = c.foundation()?; - transport.candidates.push(jingle_ice_udp::Candidate { - component: c.component_id() as u8, - foundation: foundation.to_owned(), - generation: 0, - id: Uuid::new_v4().to_string(), - ip: addr.ip(), - port: addr.port(), - priority: c.priority(), - protocol: "udp".to_owned(), - type_: match c.type_() { - nice::CandidateType::Host => jingle_ice_udp::Type::Host, - nice::CandidateType::PeerReflexive => jingle_ice_udp::Type::Prflx, - nice::CandidateType::ServerReflexive => jingle_ice_udp::Type::Srflx, - nice::CandidateType::Relayed => jingle_ice_udp::Type::Relay, - other => bail!("unsupported candidate type: {:?}", other), - }, - rel_addr: None, - rel_port: None, - network: None, - }); + let addr = c.addr(); + let foundation = c.foundation()?; + transport.candidates.push(jingle_ice_udp::Candidate { + component: c.component_id() as u8, + foundation: foundation.to_owned(), + generation: 0, + id: Uuid::new_v4().to_string(), + ip: addr.ip(), + port: addr.port(), + priority: c.priority(), + protocol: "udp".to_owned(), + type_: match c.type_() { + nice::CandidateType::Host => jingle_ice_udp::Type::Host, + nice::CandidateType::PeerReflexive => jingle_ice_udp::Type::Prflx, + nice::CandidateType::ServerReflexive => jingle_ice_udp::Type::Srflx, + nice::CandidateType::Relayed => jingle_ice_udp::Type::Relay, + other => bail!("unsupported candidate type: {:?}", other), }, - other => { - warn!("skipping unsupported ICE transport: {:?}", other); - }, - } + rel_addr: None, + rel_port: None, + network: None, + }); } jingle_accept = jingle_accept.add_content(