mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-31 20:48:56 +00:00
examples: webrtc: sendrecv: rust: Allow providing our ID via the commandline
Otherwise it continues to use a random ID as before. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3758>
This commit is contained in:
parent
541c637910
commit
638465908e
1 changed files with 7 additions and 1 deletions
|
@ -47,8 +47,12 @@ macro_rules! upgrade_weak {
|
||||||
struct Args {
|
struct Args {
|
||||||
#[clap(short, long, default_value = "wss://webrtc.nirbheek.in:8443")]
|
#[clap(short, long, default_value = "wss://webrtc.nirbheek.in:8443")]
|
||||||
server: String,
|
server: String,
|
||||||
|
/// Peer ID that should be called. If not given then an incoming call is expected.
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
peer_id: Option<u32>,
|
peer_id: Option<u32>,
|
||||||
|
/// Our ID. If not given then a random ID is created.
|
||||||
|
#[clap(short, long)]
|
||||||
|
our_id: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON messages we communicate with
|
// JSON messages we communicate with
|
||||||
|
@ -737,7 +741,9 @@ async fn async_main() -> Result<(), anyhow::Error> {
|
||||||
println!("connected");
|
println!("connected");
|
||||||
|
|
||||||
// Say HELLO to the server and see if it replies with HELLO
|
// 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 = args
|
||||||
|
.our_id
|
||||||
|
.unwrap_or_else(|| rand::thread_rng().gen_range(10..10_000));
|
||||||
println!("Registering id {} with server", our_id);
|
println!("Registering id {} with server", our_id);
|
||||||
ws.send(WsMessage::Text(format!("HELLO {}", our_id)))
|
ws.send(WsMessage::Text(format!("HELLO {}", our_id)))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
Loading…
Reference in a new issue