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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1262>
This commit is contained in:
Olivier Crête 2023-06-27 13:59:53 -04:00 committed by GStreamer Marge Bot
parent 793ee66afa
commit 817b60a758
3 changed files with 18 additions and 20 deletions

View file

@ -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!(),
}

View file

@ -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!(),
}

View file

@ -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!(),
}