compatibility with libnice 0.1.16

This commit is contained in:
Jasper Hugo 2021-08-14 13:04:40 +07:00
parent 120bcdbe7d
commit 57f78656a3
4 changed files with 34 additions and 39 deletions

5
Cargo.lock generated
View File

@ -656,7 +656,6 @@ dependencies = [
"nice-gst-meet", "nice-gst-meet",
"once_cell", "once_cell",
"pem", "pem",
"pkg-config",
"rand", "rand",
"rcgen", "rcgen",
"ring", "ring",
@ -668,6 +667,10 @@ dependencies = [
"xmpp-parsers-gst-meet", "xmpp-parsers-gst-meet",
] ]
[[package]]
name = "lib-gst-meet-c"
version = "0.1.0"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.99" version = "0.2.99"

View File

@ -1,2 +1,8 @@
[workspace] [workspace]
members = ["lib-gst-meet", "gst-meet", "nice-gst-meet", "nice-gst-meet-sys"] members = [
"gst-meet",
"lib-gst-meet",
"lib-gst-meet-c",
"nice-gst-meet",
"nice-gst-meet-sys",
]

View File

@ -13,12 +13,12 @@ async-trait = { version = "0.1", default-features = false }
bytes = { version = "1", default-features = false, features = ["std"] } bytes = { version = "1", default-features = false, features = ["std"] }
futures = { version = "0.3", default-features = false } futures = { version = "0.3", default-features = false }
glib = { version = "0.14", 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"] } hex = { version = "0.4", default-features = false, features = ["std"] }
itertools = { version = "0.10", default-features = false, features = ["use_std"] } itertools = { version = "0.10", default-features = false, features = ["use_std"] }
libc = { version = "0.2", default-features = false } libc = { version = "0.2", default-features = false }
maplit = { version = "1", 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"] } once_cell = { version = "1", default-features = false, features = ["std"] }
pem = { version = "0.8", default-features = false } pem = { version = "0.8", default-features = false }
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] } 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"] } tracing = { version = "0.1", default-features = false, features = ["attributes", "std"] }
uuid = { version = "0.8", default-features = false, features = ["v4"] } uuid = { version = "0.8", default-features = false, features = ["v4"] }
xmpp-parsers = { package = "xmpp-parsers-gst-meet", version = "0.18", default-features = false } xmpp-parsers = { package = "xmpp-parsers-gst-meet", version = "0.18", default-features = false }
[build-dependencies]
pkg-config = { version = "0.3", default-features = false }

View File

@ -338,10 +338,6 @@ impl JingleSession {
candidate.set_foundation(&c.foundation); candidate.set_foundation(&c.foundation);
candidate.set_addr(SocketAddr::new(c.ip, c.port)); candidate.set_addr(SocketAddr::new(c.ip, c.port));
candidate.set_priority(c.priority); 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_username(ufrag);
candidate.set_password(pwd); candidate.set_password(pwd);
debug!("candidate: {:?}", candidate); debug!("candidate: {:?}", candidate);
@ -757,35 +753,28 @@ impl JingleSession {
transport.pwd = Some(ice_local_pwd.clone()); transport.pwd = Some(ice_local_pwd.clone());
transport.candidates = vec![]; transport.candidates = vec![];
for c in &local_candidates { for c in &local_candidates {
match c.transport() { let addr = c.addr();
nice::CandidateTransport::Udp => { let foundation = c.foundation()?;
let addr = c.addr(); transport.candidates.push(jingle_ice_udp::Candidate {
let foundation = c.foundation()?; component: c.component_id() as u8,
transport.candidates.push(jingle_ice_udp::Candidate { foundation: foundation.to_owned(),
component: c.component_id() as u8, generation: 0,
foundation: foundation.to_owned(), id: Uuid::new_v4().to_string(),
generation: 0, ip: addr.ip(),
id: Uuid::new_v4().to_string(), port: addr.port(),
ip: addr.ip(), priority: c.priority(),
port: addr.port(), protocol: "udp".to_owned(),
priority: c.priority(), type_: match c.type_() {
protocol: "udp".to_owned(), nice::CandidateType::Host => jingle_ice_udp::Type::Host,
type_: match c.type_() { nice::CandidateType::PeerReflexive => jingle_ice_udp::Type::Prflx,
nice::CandidateType::Host => jingle_ice_udp::Type::Host, nice::CandidateType::ServerReflexive => jingle_ice_udp::Type::Srflx,
nice::CandidateType::PeerReflexive => jingle_ice_udp::Type::Prflx, nice::CandidateType::Relayed => jingle_ice_udp::Type::Relay,
nice::CandidateType::ServerReflexive => jingle_ice_udp::Type::Srflx, other => bail!("unsupported candidate type: {:?}", other),
nice::CandidateType::Relayed => jingle_ice_udp::Type::Relay,
other => bail!("unsupported candidate type: {:?}", other),
},
rel_addr: None,
rel_port: None,
network: None,
});
}, },
other => { rel_addr: None,
warn!("skipping unsupported ICE transport: {:?}", other); rel_port: None,
}, network: None,
} });
} }
jingle_accept = jingle_accept.add_content( jingle_accept = jingle_accept.add_content(