examples: webrtc: rust: Update dependencies

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8625>
This commit is contained in:
Sebastian Dröge 2025-03-12 19:28:04 +02:00 committed by GStreamer Marge Bot
parent 9b47a2dde3
commit 48cec32341
9 changed files with 1885 additions and 1412 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,8 +10,8 @@ futures = "0.3"
clap = { version = "4", features = ["derive"] }
anyhow = "1"
url = "2"
rand = "0.8"
async-tungstenite = { version = "0.27", features = ["gio-runtime"] }
rand = { version = "0.9", features = ["thread_rng"] }
async-tungstenite = { version = "0.29", features = ["gio-runtime"] }
gst = { package = "gstreamer", version = "0.23" }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.23" }
gst-sdp = { package = "gstreamer-sdp", version = "0.23" }

View File

@ -153,8 +153,8 @@ struct JsonReply {
}
fn transaction_id() -> String {
thread_rng()
.sample_iter(&rand::distributions::Alphanumeric)
rand::rng()
.sample_iter(&rand::distr::Alphanumeric)
.map(char::from)
.take(30)
.collect()
@ -244,7 +244,7 @@ impl Peer {
let transaction = transaction_id();
let sdp_data = offer.sdp().as_text()?;
let msg = WsMessage::Text(
let msg = WsMessage::text(
json!({
"janus": "message",
"transaction": transaction,
@ -363,7 +363,7 @@ impl Peer {
fn on_ice_candidate(&self, mlineindex: u32, candidate: &str) -> Result<(), anyhow::Error> {
let transaction = transaction_id();
info!("Sending ICE {} {}", mlineindex, &candidate);
let msg = WsMessage::Text(
let msg = WsMessage::text(
json!({
"janus": "trickle",
"transaction": transaction,
@ -420,7 +420,7 @@ impl JanusGateway {
let (mut ws, _) = connect_async(request).await?;
let transaction = transaction_id();
let msg = WsMessage::Text(
let msg = WsMessage::text(
json!({
"janus": "create",
"transaction": transaction,
@ -440,7 +440,7 @@ impl JanusGateway {
let session_id = json_msg.data.expect("no session id").id;
let transaction = transaction_id();
let msg = WsMessage::Text(
let msg = WsMessage::text(
json!({
"janus": "attach",
"transaction": transaction,
@ -462,7 +462,7 @@ impl JanusGateway {
let handle = json_msg.data.expect("no session id").id;
let transaction = transaction_id();
let msg = WsMessage::Text(
let msg = WsMessage::text(
json!({
"janus": "message",
"transaction": transaction,
@ -631,7 +631,7 @@ impl JanusGateway {
// Handle keepalive ticks, fired every 10 seconds
_ws_msg = timer_fuse.select_next_some() => {
let transaction = transaction_id();
Some(WsMessage::Text(
Some(WsMessage::text(
json!({
"janus": "keepalive",
"transaction": transaction,

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,8 @@ futures = "0.3"
async-std = "1"
clap = { version = "4", features = ["derive"] }
anyhow = "1"
rand = "0.8"
async-tungstenite = { version = "0.27", features = ["async-std-runtime", "async-native-tls"] }
rand = { version = "0.9", features = ["thread_rng"] }
async-tungstenite = { version = "0.29", features = ["async-std-runtime", "async-native-tls"] }
gst = { package = "gstreamer", version = "0.23" }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.23" }
gst-sdp = { package = "gstreamer-sdp", version = "0.23" }
@ -19,4 +19,4 @@ serde_derive = "1"
serde_json = "1"
[target.'cfg(target_os = "macos")'.dependencies]
cocoa = "0.25"
cocoa = "0.26"

View File

@ -659,7 +659,7 @@ impl Peer {
self.send_msg_tx
.lock()
.unwrap()
.unbounded_send(WsMessage::Text(format!(
.unbounded_send(WsMessage::text(format!(
"ROOM_PEER_MSG {} {}",
self.peer_id, message
)))
@ -706,7 +706,7 @@ impl Peer {
self.send_msg_tx
.lock()
.unwrap()
.unbounded_send(WsMessage::Text(format!(
.unbounded_send(WsMessage::text(format!(
"ROOM_PEER_MSG {} {}",
self.peer_id, message
)))
@ -794,7 +794,7 @@ impl Peer {
self.send_msg_tx
.lock()
.unwrap()
.unbounded_send(WsMessage::Text(format!(
.unbounded_send(WsMessage::text(format!(
"ROOM_PEER_MSG {} {}",
self.peer_id, message
)))
@ -988,21 +988,21 @@ async fn async_main() -> Result<(), anyhow::Error> {
println!("connected");
// Say HELLO to the server and see if it replies with HELLO
let our_id = rand::thread_rng().gen_range(10..10_000);
let our_id = rand::rng().random_range(10..10_000);
println!("Registering id {our_id} with server");
ws.send(WsMessage::Text(format!("HELLO {our_id}"))).await?;
ws.send(WsMessage::text(format!("HELLO {our_id}"))).await?;
let msg = ws
.next()
.await
.ok_or_else(|| anyhow!("didn't receive anything"))??;
if msg != WsMessage::Text("HELLO".into()) {
if msg != WsMessage::text("HELLO") {
bail!("server didn't say HELLO");
}
// Join the given room
ws.send(WsMessage::Text(format!("ROOM {}", args.room_id)))
ws.send(WsMessage::text(format!("ROOM {}", args.room_id)))
.await?;
let msg = ws

File diff suppressed because it is too large Load Diff

View File

@ -9,8 +9,8 @@ futures = "0.3"
async-std = "1"
clap = { version = "4", features = ["derive"] }
anyhow = "1"
rand = "0.8"
async-tungstenite = { version = "0.27", features = ["async-std-runtime", "async-native-tls"] }
rand = { version = "0.9", features = ["thread_rng"] }
async-tungstenite = { version = "0.29", features = ["async-std-runtime", "async-native-tls"] }
gst = { package = "gstreamer", version = "0.23" }
gst-rtp = { package = "gstreamer-rtp", version = "0.23", features = ["v1_20"] }
gst-webrtc = { package = "gstreamer-webrtc", version = "0.23" }
@ -20,4 +20,4 @@ serde_derive = "1"
serde_json = "1"
[target.'cfg(target_os = "macos")'.dependencies]
cocoa = "0.25"
cocoa = "0.26"

View File

@ -359,7 +359,7 @@ impl App {
self.send_msg_tx
.lock()
.unwrap()
.unbounded_send(WsMessage::Text(message))
.unbounded_send(WsMessage::text(message))
.context("Failed to send SDP offer")?;
Ok(())
@ -403,7 +403,7 @@ impl App {
self.send_msg_tx
.lock()
.unwrap()
.unbounded_send(WsMessage::Text(message))
.unbounded_send(WsMessage::text(message))
.context("Failed to send SDP answer")?;
Ok(())
@ -580,7 +580,7 @@ impl App {
self.send_msg_tx
.lock()
.unwrap()
.unbounded_send(WsMessage::Text(message))
.unbounded_send(WsMessage::text(message))
.context("Failed to send ICE candidate")?;
Ok(())
@ -763,16 +763,16 @@ async fn async_main() -> Result<(), anyhow::Error> {
// Say HELLO to the server and see if it replies with HELLO
let our_id = args
.our_id
.unwrap_or_else(|| rand::thread_rng().gen_range(10..10_000));
.unwrap_or_else(|| rand::rng().random_range(10..10_000));
println!("Registering id {our_id} with server");
ws.send(WsMessage::Text(format!("HELLO {our_id}"))).await?;
ws.send(WsMessage::text(format!("HELLO {our_id}"))).await?;
let msg = ws
.next()
.await
.ok_or_else(|| anyhow!("didn't receive anything"))??;
if msg != WsMessage::Text("HELLO".into()) {
if msg != WsMessage::text("HELLO") {
bail!("server didn't say HELLO");
}
@ -780,7 +780,7 @@ async fn async_main() -> Result<(), anyhow::Error> {
println!("Setting up call with peer id {peer_id}");
// Join the given session
ws.send(WsMessage::Text(format!("SESSION {peer_id}")))
ws.send(WsMessage::text(format!("SESSION {peer_id}")))
.await?;
let msg = ws
@ -788,14 +788,14 @@ async fn async_main() -> Result<(), anyhow::Error> {
.await
.ok_or_else(|| anyhow!("didn't receive anything"))??;
if msg != WsMessage::Text("SESSION_OK".into()) {
if msg != WsMessage::text("SESSION_OK") {
bail!("server error: {msg:?}");
}
// If we expect the peer to create the offer request it now
if args.remote_offerer {
println!("Requesting offer from peer");
ws.send(WsMessage::Text("OFFER_REQUEST".into())).await?;
ws.send(WsMessage::text("OFFER_REQUEST")).await?;
}
} else {
println!("Waiting for incoming call");