Compatibility fixes

* Allow focus to be a bare or full JID (thanks @teowoz & @Tellyo)
* If extdisco fails, just continue without STUN/TURN (thanks @teowoz &
  @Tellyo)
* Updated deps for new colibri protocol crate
* rustfmt
This commit is contained in:
Jasper Hugo 2021-10-11 10:33:29 +07:00
parent 5c72befcef
commit fab8efe5fb
6 changed files with 50 additions and 28 deletions

28
Cargo.lock generated
View File

@ -111,9 +111,9 @@ checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
[[package]]
name = "cc"
version = "1.0.70"
version = "1.0.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0"
checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd"
[[package]]
name = "cfg-expr"
@ -186,9 +186,9 @@ dependencies = [
[[package]]
name = "colibri"
version = "0.1.1"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e90829b3ef30aafd6f707b32665623656cae1c3fd5dfdf090f41bb8855f336d5"
checksum = "9b66649321a779420276afffc6b421952c1c973ba1a4434f1d1e11b9bf1b312b"
dependencies = [
"serde",
"serde_json",
@ -433,9 +433,9 @@ dependencies = [
[[package]]
name = "gio"
version = "0.14.6"
version = "0.14.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3a29d8062af72045518271a2cd98b4e1617ce43f5b4223ad0fb9a0eff8f718c"
checksum = "711c3632b3ebd095578a9c091418d10fed492da9443f58ebc8f45efbeb215cb0"
dependencies = [
"bitflags",
"futures-channel",
@ -463,9 +463,9 @@ dependencies = [
[[package]]
name = "glib"
version = "0.14.5"
version = "0.14.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4a930b7208e6e0ab839eea5f65ac2b82109f729621430d47fe905e2e09d33f4"
checksum = "7c515f1e62bf151ef6635f528d05b02c11506de986e43b34a5c920ef0b3796a4"
dependencies = [
"bitflags",
"futures-channel",
@ -1521,18 +1521,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.29"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88"
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.29"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c"
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
dependencies = [
"proc-macro2",
"quote",
@ -1730,9 +1730,9 @@ checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"
[[package]]
name = "unicode-bidi"
version = "0.3.6"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085"
checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f"
[[package]]
name = "unicode-normalization"

View File

@ -10,7 +10,7 @@ use gstreamer::{
GhostPad,
};
use lib_gst_meet::{
Authentication, init_tracing, JitsiConference, JitsiConferenceConfig, Connection,
init_tracing, Authentication, Connection, JitsiConference, JitsiConferenceConfig,
};
use structopt::StructOpt;
use tokio::{signal::ctrl_c, task, time::timeout};
@ -45,9 +45,9 @@ struct Opt {
#[structopt(long)]
select_endpoints: Option<String>,
#[structopt(long)]
last_n: Option<u16>,
last_n: Option<i32>,
#[structopt(long)]
recv_video_height: Option<u16>,
recv_video_height: Option<i32>,
#[structopt(long)]
video_type: Option<String>,
#[structopt(short, long, parse(from_occurrences))]
@ -113,9 +113,13 @@ async fn main_inner() -> Result<()> {
.transpose()
.context("failed to parse send pipeline")?;
let (connection, background) = Connection::new(&opt.web_socket_url, &opt.xmpp_domain, Authentication::Anonymous)
.await
.context("failed to connect")?;
let (connection, background) = Connection::new(
&opt.web_socket_url,
&opt.xmpp_domain,
Authentication::Anonymous,
)
.await
.context("failed to connect")?;
tokio::spawn(background);
@ -211,10 +215,21 @@ async fn main_inner() -> Result<()> {
if let Some(template) = recv_pipeline_participant_template {
let pipeline_description = template
.replace("{jid}", &participant.jid.as_ref().map(|jid| jid.to_string()).context("missing jid")?)
.replace(
"{jid}",
&participant
.jid
.as_ref()
.map(|jid| jid.to_string())
.context("missing jid")?,
)
.replace(
"{jid_user}",
participant.jid.as_ref().and_then(|jid| jid.node.as_ref()).context("jid missing node")?,
participant
.jid
.as_ref()
.and_then(|jid| jid.node.as_ref())
.context("jid missing node")?,
)
.replace("{participant_id}", &participant.muc_jid.resource)
.replace("{nick}", &participant.nick.unwrap_or_default());

View File

@ -149,7 +149,11 @@ pub unsafe extern "C" fn gstmeet_connection_join_conference(
};
(*context)
.runtime
.block_on(JitsiConference::join((*connection).clone(), from_glib_full(glib_main_context), config))
.block_on(JitsiConference::join(
(*connection).clone(),
from_glib_full(glib_main_context),
config,
))
.ok_raw_or_log()
}
@ -237,7 +241,9 @@ pub unsafe extern "C" fn gstmeet_conference_on_participant(
let participant = Participant {
jid: participant
.jid
.map(|jid| Ok::<_, anyhow::Error>(CString::new(jid.to_string())?.into_raw() as *const _))
.map(
|jid| Ok::<_, anyhow::Error>(CString::new(jid.to_string())?.into_raw() as *const _),
)
.transpose()?
.unwrap_or_else(ptr::null),
muc_jid: CString::new(participant.muc_jid.to_string())?.into_raw() as *const _,

View File

@ -74,7 +74,7 @@ enum JitsiConferenceState {
#[derive(Debug, Clone)]
pub struct JitsiConferenceConfig {
pub muc: BareJid,
pub focus: FullJid,
pub focus: Jid,
pub nick: String,
pub region: String,
pub video_codec: String,
@ -175,7 +175,7 @@ impl JitsiConference {
xmpp_connection.add_stanza_filter(conference.clone()).await;
let iq = Iq::from_set(generate_id(), conference_stanza).with_to(Jid::Full(focus));
let iq = Iq::from_set(generate_id(), conference_stanza).with_to(focus);
xmpp_connection.tx.send(iq.into()).await?;
rx.await?;

View File

@ -7,13 +7,14 @@ mod stanza_filter;
mod util;
mod xmpp;
pub use xmpp_parsers;
pub use crate::{
conference::{Feature, JitsiConference, JitsiConferenceConfig, Participant},
source::MediaType,
stanza_filter::StanzaFilter,
xmpp::connection::{Authentication, Connection},
};
pub use xmpp_parsers;
#[cfg(feature = "tracing-subscriber")]
pub fn init_tracing(level: tracing::Level) {

View File

@ -290,7 +290,7 @@ impl Connection {
locked_inner.external_services = services.services;
}
else {
bail!("extdisco failed");
warn!("discovering external services failed: STUN/TURN will not work");
}
if let Some(tx) = locked_inner.connected_tx.take() {