Skip to content

Commit

Permalink
gst-meet: Update deps, adjust signalling for Jitsi changes
Browse files Browse the repository at this point in the history
* Added signalling of source name and video type, colibri
  SourceVideoTypeMessage, presence SourceInfo, and correct msid format,
  to be compatible with multi-stream changes at Jitsi
* Switched rustls backend from ring to aws-lc-rs
* Updated GStreamer for upstream RTP fixes
  • Loading branch information
jbg committed May 25, 2024
1 parent a24d1de commit e6848f4
Show file tree
Hide file tree
Showing 11 changed files with 1,149 additions and 844 deletions.
1,472 changes: 873 additions & 599 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"gst-meet",
"lib-gst-meet",
Expand Down
8 changes: 4 additions & 4 deletions gst-meet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ authors = ["Jasper Hugo <jasper@avstack.io>"]
anyhow = { version = "1", default-features = false, features = ["std"] }
colibri = { version = "0.1", default-features = false }
futures = { version = "0.3", default-features = false }
glib = { version = "0.17", default-features = false, features = ["log"] }
gstreamer = { version = "0.20", default-features = false }
http = { version = "0.2", default-features = false }
glib = { version = "0.19", default-features = false, features = ["log"] }
gstreamer = { version = "0.22", default-features = false }
http = { version = "1", default-features = false }
lib-gst-meet = { version = "0.8", path = "../lib-gst-meet", default-features = false, features = ["tracing-subscriber"] }
serde_urlencoded = { version = "0.7", default-features = false }
structopt = { version = "0.3", default-features = false }
Expand All @@ -21,7 +21,7 @@ tokio-stream = { version = "0.1", default-features = false }
tracing = { version = "0.1", default-features = false, features = ["attributes", "std"] }

[target.'cfg(target_os = "macos")'.dependencies]
cocoa = { version = "0.24", default-features = false }
cocoa = { version = "0.25", default-features = false }

[features]
default = ["tls-rustls-native-roots"]
Expand Down
61 changes: 34 additions & 27 deletions gst-meet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use anyhow::{bail, Context, Result};
#[cfg(target_os = "macos")]
use cocoa::appkit::NSApplication;
use colibri::{ColibriMessage, Constraints, VideoType};
use glib::ObjectExt;
use glib::object::ObjectExt as _;
use gstreamer::{
prelude::{ElementExt, ElementExtManual, GstBinExt},
prelude::{ElementExt as _, ElementExtManual as _, GstBinExt as _},
GhostPad,
};
use http::Uri;
Expand Down Expand Up @@ -47,19 +47,13 @@ struct Opt {
)]
focus_jid: Option<String>,

#[structopt(
long,
help = "If not specified, anonymous auth is used."
)]
#[structopt(long, help = "If not specified, anonymous auth is used.")]
xmpp_username: Option<String>,

#[structopt(long)]
xmpp_password: Option<String>,

#[structopt(
long,
help = "The JWT token for Jitsi JWT authentication"
)]
#[structopt(long, help = "The JWT token for Jitsi JWT authentication")]
xmpp_jwt: Option<String>,

#[structopt(
Expand Down Expand Up @@ -216,14 +210,14 @@ async fn main_inner() -> Result<()> {
let send_pipeline = opt
.send_pipeline
.as_ref()
.map(|pipeline| gstreamer::parse_bin_from_description(pipeline, false))
.map(|pipeline| gstreamer::parse::bin_from_description(pipeline, false))
.transpose()
.context("failed to parse send pipeline")?;

let recv_pipeline = opt
.recv_pipeline
.as_ref()
.map(|pipeline| gstreamer::parse_bin_from_description(pipeline, false))
.map(|pipeline| gstreamer::parse::bin_from_description(pipeline, false))
.transpose()
.context("failed to parse recv pipeline")?;

Expand All @@ -240,14 +234,17 @@ async fn main_inner() -> Result<()> {
if !qs.contains_key("room") {
qs.insert("room".to_owned(), opt.room_name.clone());
}
Ok::<_, anyhow::Error>(format!(
"{}?{}",
path_and_query.path(),
serde_urlencoded::to_string(&qs)?,
).parse()?)
Ok::<_, anyhow::Error>(
format!(
"{}?{}",
path_and_query.path(),
serde_urlencoded::to_string(&qs)?,
)
.parse()?,
)
})
.transpose()?;

web_socket_url = Uri::from_parts(web_socket_url_parts)?;

let xmpp_domain = opt
Expand All @@ -262,11 +259,13 @@ async fn main_inner() -> Result<()> {
match opt.xmpp_username {
Some(username) => Authentication::Plain {
username,
password: opt.xmpp_password.context("if xmpp-username is provided, xmpp-password must also be provided")?,
password: opt
.xmpp_password
.context("if xmpp-username is provided, xmpp-password must also be provided")?,
},
None => match opt.xmpp_jwt {
Some(token) => Authentication::Jwt { token },
None => Authentication::Anonymous,
Some(token) => Authentication::Jwt { token },
None => Authentication::Anonymous,
},
},
&opt.room_name,
Expand Down Expand Up @@ -438,32 +437,40 @@ async fn main_inner() -> Result<()> {
participant
.jid
.as_ref()
.and_then(|jid| jid.node.as_deref())
.and_then(|jid| jid.node_str())
.unwrap_or_default(),
)
.replace("{participant_id}", &participant.muc_jid.resource)
.replace("{participant_id}", &participant.muc_jid.resource_str())
.replace("{nick}", &participant.nick.unwrap_or_default());

let bin = gstreamer::parse_bin_from_description(&pipeline_description, false)
let bin = gstreamer::parse::bin_from_description(&pipeline_description, false)
.context("failed to parse recv pipeline participant template")?;

if let Some(audio_sink_element) = bin.by_name("audio") {
let sink_pad = audio_sink_element.static_pad("sink").context(
"audio sink element in recv pipeline participant template has no sink pad",
)?;
bin.add_pad(&GhostPad::with_target(Some("audio"), &sink_pad)?)?;
bin.add_pad(
&GhostPad::builder_with_target(&sink_pad)?
.name("audio")
.build(),
)?;
}

if let Some(video_sink_element) = bin.by_name("video") {
let sink_pad = video_sink_element.static_pad("sink").context(
"video sink element in recv pipeline participant template has no sink pad",
)?;
bin.add_pad(&GhostPad::with_target(Some("video"), &sink_pad)?)?;
bin.add_pad(
&GhostPad::builder_with_target(&sink_pad)?
.name("video")
.build(),
)?;
}

bin.set_property(
"name",
format!("participant_{}", participant.muc_jid.resource),
format!("participant_{}", participant.muc_jid.resource()),
);
conference.add_bin(&bin).await?;
}
Expand Down
4 changes: 2 additions & 2 deletions lib-gst-meet-c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ authors = ["Jasper Hugo <jasper@avstack.io>"]

[dependencies]
anyhow = { version = "1", default-features = false }
glib = { version = "0.17", default-features = false }
gstreamer = { version = "0.20", default-features = false }
glib = { version = "0.19", default-features = false }
gstreamer = { version = "0.22", default-features = false }
lib-gst-meet = { version = "0.8", path = "../lib-gst-meet", default-features = false, features = ["tracing-subscriber"] }
tokio = { version = "1", default-features = false, features = ["rt-multi-thread"] }
tracing = { version = "0.1", default-features = false }
Expand Down
7 changes: 5 additions & 2 deletions lib-gst-meet-c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,27 @@ pub unsafe extern "C" fn gstmeet_init_tracing(level: *const c_char) {

#[no_mangle]
pub unsafe extern "C" fn gstmeet_deinit(context: *mut Context) {
Box::from_raw(context);
let _ = Box::from_raw(context);
}

#[no_mangle]
pub unsafe extern "C" fn gstmeet_connection_new(
context: *mut Context,
websocket_url: *const c_char,
xmpp_domain: *const c_char,
room_name: *const c_char,
tls_insecure: bool,
) -> *mut Connection {
let websocket_url = CStr::from_ptr(websocket_url);
let xmpp_domain = CStr::from_ptr(xmpp_domain);
let room_name = CStr::from_ptr(room_name);
(*context)
.runtime
.block_on(Connection::new(
&websocket_url.to_string_lossy(),
&xmpp_domain.to_string_lossy(),
Authentication::Anonymous,
&room_name.to_string_lossy(),
tls_insecure,
))
.map(|(connection, background)| {
Expand All @@ -101,7 +104,7 @@ pub unsafe extern "C" fn gstmeet_connection_new(

#[no_mangle]
pub unsafe extern "C" fn gstmeet_connection_free(connection: *mut Connection) {
Box::from_raw(connection);
let _ = Box::from_raw(connection);
}

#[no_mangle]
Expand Down
33 changes: 17 additions & 16 deletions lib-gst-meet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,35 @@ authors = ["Jasper Hugo <jasper@avstack.io>"]
anyhow = { version = "1", default-features = false, features = ["std"] }
async-stream = { version = "0.3", default-features = false }
async-trait = { version = "0.1", default-features = false }
base64 = { version = "0.21", default-features = false }
base64 = { version = "0.22", default-features = false }
bytes = { version = "1", default-features = false, features = ["std"] }
colibri = { version = "0.1", default-features = false }
futures = { version = "0.3", default-features = false }
glib = { version = "0.17", default-features = false }
gstreamer = { version = "0.20", default-features = false, features = ["v1_20"] }
gstreamer-rtp = { version = "0.20", default-features = false, features = ["v1_20"] }
glib = { version = "0.19", default-features = false }
gstreamer = { version = "0.22", default-features = false, features = ["v1_20"] }
gstreamer-rtp = { version = "0.22", default-features = false, features = ["v1_20"] }
hex = { version = "0.4", default-features = false, features = ["std"] }
itertools = { version = "0.10", default-features = false, features = ["use_std"] }
itertools = { version = "0.13", default-features = false, features = ["use_std"] }
jid = { version = "0.10", default-features = false }
jitsi-xmpp-parsers = { version = "0.2", path = "../jitsi-xmpp-parsers", default-features = false }
libc = { version = "0.2", default-features = false }
maplit = { version = "1", default-features = false }
native-tls = { version = "0.2", default-features = false, optional = true }
nice-gst-meet = { version = "0.3", path = "../nice-gst-meet", default-features = false, features = ["v0_1_18"] }
once_cell = { version = "1", default-features = false, features = ["std"] }
pem = { version = "2", default-features = false }
rand = { version = "0.8", default-features = false, features = ["std", "std_rng"] }
rcgen = { version = "0.11", default-features = false }
ring = { version = "0.16", default-features = false }
rtcp = { version = "0.8", default-features = false, optional = true }
rustls = { version = "0.21", default-features = false, features = ["logging", "tls12"], optional = true }
rustls-native-certs = { version = "0.6", default-features = false, optional = true }
rcgen = { version = "0.13", default-features = false, features = ["crypto", "pem", "aws_lc_rs"] }
ring = { version = "0.17", default-features = false }
rtcp = { version = "0.11", default-features = false, optional = true }
rustls = { version = "0.22", default-features = false, features = ["logging", "tls12", "aws_lc_rs"], optional = true }
rustls-native-certs = { version = "0.7", default-features = false, optional = true }
serde = { version = "1", default-features = false, features = ["derive"] }
serde_json = { version = "1", default-features = false, features = ["std"] }
sha2 = { version = "0.10", default-features = false, features = ["std"] }
syntect = { version = "5", optional = true }
tokio = { version = "1", default-features = false, features = ["rt-multi-thread", "macros", "sync", "time"] }
tokio-stream = { version = "0.1", default-features = false, features = ["time"] }
tokio-tungstenite = { version = "0.19", default-features = false, features = ["connect"] }
tokio-tungstenite = { version = "0.21", default-features = false, features = ["connect"] }
tracing = { version = "0.1", default-features = false, features = ["attributes", "std"] }
tracing-subscriber = { version = "0.3", optional = true, default-features = false, features = [
"fmt",
Expand All @@ -50,8 +51,8 @@ tracing-subscriber = { version = "0.3", optional = true, default-features = fals
"tracing-log",
] }
uuid = { version = "1", default-features = false, features = ["v4"] }
webpki-roots = { version = "0.23", default-features = false, optional = true }
xmpp-parsers = { version = "0.19", default-features = false, features = ["disable-validation"] }
webpki-roots = { version = "0.26", default-features = false, optional = true }
xmpp-parsers = { version = "0.20", default-features = false, features = ["disable-validation"] }

[features]
# Ideally we would enable rustls/dangerous_configuration only when tls-insecure is enabled, but until weak-dep-features is stabilised, that
Expand All @@ -62,5 +63,5 @@ syntax-highlighting = ["syntect"]
tls-insecure = []
tls-native = ["tokio-tungstenite/native-tls", "native-tls"]
tls-native-vendored = ["tokio-tungstenite/native-tls-vendored", "native-tls/vendored"]
tls-rustls-native-roots = ["tokio-tungstenite/rustls-tls-native-roots", "rustls", "rustls-native-certs", "rustls/dangerous_configuration"]
tls-rustls-webpki-roots = ["tokio-tungstenite/rustls-tls-webpki-roots", "rustls", "webpki-roots", "rustls/dangerous_configuration"]
tls-rustls-native-roots = ["tokio-tungstenite/rustls-tls-native-roots", "rustls", "rustls-native-certs"]
tls-rustls-webpki-roots = ["tokio-tungstenite/rustls-tls-webpki-roots", "rustls", "webpki-roots"]
Loading

0 comments on commit e6848f4

Please sign in to comment.