From 817b60a75838645bb9d8589488e37f34dab5e41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Tue, 27 Jun 2023 13:59:53 -0400 Subject: [PATCH] webrtc: Value.get() is already type checks in the property calls GObject will have ensured we get a GValue of the right type. Part-of: --- net/webrtc/src/aws_kvs_signaller/imp.rs | 12 ++++++------ net/webrtc/src/livekit_signaller/imp.rs | 16 ++++++++-------- net/webrtc/src/whip_signaller/imp.rs | 10 ++++------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/net/webrtc/src/aws_kvs_signaller/imp.rs b/net/webrtc/src/aws_kvs_signaller/imp.rs index 206bdcd1..13d9a79f 100644 --- a/net/webrtc/src/aws_kvs_signaller/imp.rs +++ b/net/webrtc/src/aws_kvs_signaller/imp.rs @@ -669,7 +669,7 @@ impl ObjectImpl for Signaller { fn set_property(&self, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) { match pspec.name() { "address" => { - let address: Option<_> = value.get().expect("type checked upstream"); + let address: Option<_> = value.get().unwrap(); if let Some(address) = address { gst::info!(CAT, "Signaller address set to {address}"); @@ -687,23 +687,23 @@ impl ObjectImpl for Signaller { } "access-key" => { let mut settings = self.settings.lock().unwrap(); - settings.access_key = value.get().expect("type checked upstream"); + settings.access_key = value.get().unwrap(); } "secret-access-key" => { let mut settings = self.settings.lock().unwrap(); - settings.secret_access_key = value.get().expect("type checked upstream"); + settings.secret_access_key = value.get().unwrap(); } "session-token" => { let mut settings = self.settings.lock().unwrap(); - settings.session_token = value.get().expect("type checked upstream"); + settings.session_token = value.get().unwrap(); } "channel-name" => { let mut settings = self.settings.lock().unwrap(); - settings.channel_name = value.get().expect("type checked upstream"); + settings.channel_name = value.get().unwrap(); } "ping-timeout" => { let mut settings = self.settings.lock().unwrap(); - settings.ping_timeout = value.get().expect("type checked upstream"); + settings.ping_timeout = value.get().unwrap(); } _ => unimplemented!(), } diff --git a/net/webrtc/src/livekit_signaller/imp.rs b/net/webrtc/src/livekit_signaller/imp.rs index 4599a996..9b1d1f76 100644 --- a/net/webrtc/src/livekit_signaller/imp.rs +++ b/net/webrtc/src/livekit_signaller/imp.rs @@ -654,28 +654,28 @@ impl ObjectImpl for Signaller { let mut settings = self.settings.lock().unwrap(); match pspec.name() { "ws-url" => { - settings.wsurl = value.get().expect("WebSocket URL should be a string"); + settings.wsurl = value.get().unwrap(); } "api-key" => { - settings.api_key = value.get().expect("API Key should be a string"); + settings.api_key = value.get().unwrap(); } "secret-key" => { - settings.secret_key = value.get().expect("Secret Key should be a string"); + settings.secret_key = value.get().unwrap(); } "participant-name" => { - settings.participant_name = value.get().expect("Participant Name should be a string"); + settings.participant_name = value.get().unwrap(); } "identity" => { - settings.identity = value.get().expect("Participant Identity should be a string"); + settings.identity = value.get().unwrap(); } "room-name" => { - settings.room_name = value.get().expect("Room Name should be a string"); + settings.room_name = value.get().unwrap(); } "auth-token" => { - settings.auth_token = value.get().expect("Auth token should be a string"); + settings.auth_token = value.get().unwrap(); } "timeout" => { - settings.timeout = value.get().expect("type checked upstream"); + settings.timeout = value.get().unwrap(); } _ => unimplemented!(), } diff --git a/net/webrtc/src/whip_signaller/imp.rs b/net/webrtc/src/whip_signaller/imp.rs index a26aba78..9169b183 100644 --- a/net/webrtc/src/whip_signaller/imp.rs +++ b/net/webrtc/src/whip_signaller/imp.rs @@ -568,21 +568,19 @@ impl ObjectImpl for Signaller { match pspec.name() { "whip-endpoint" => { let mut settings = self.settings.lock().unwrap(); - settings.whip_endpoint = value.get().expect("WHIP endpoint should be a string"); + settings.whip_endpoint = value.get().unwrap(); } "use-link-headers" => { let mut settings = self.settings.lock().unwrap(); - settings.use_link_headers = value - .get() - .expect("use-link-headers should be a boolean value"); + settings.use_link_headers = value.get().unwrap(); } "auth-token" => { let mut settings = self.settings.lock().unwrap(); - settings.auth_token = value.get().expect("Auth token should be a string"); + settings.auth_token = value.get().unwrap(); } "timeout" => { let mut settings = self.settings.lock().unwrap(); - settings.timeout = value.get().expect("type checked upstream"); + settings.timeout = value.get().unwrap(); } _ => unimplemented!(), }