Remove needless to_value() calls

This commit is contained in:
Sebastian Dröge 2021-11-20 14:56:34 +02:00
parent 63337c7df1
commit ac60e7b101

View file

@ -1245,15 +1245,11 @@ impl WebRTCSink {
.unwrap(); .unwrap();
if let Some(stun_server) = settings.stun_server.as_ref() { if let Some(stun_server) = settings.stun_server.as_ref() {
webrtcbin webrtcbin.set_property("stun-server", stun_server).unwrap();
.set_property("stun-server", stun_server.to_value())
.unwrap();
} }
if let Some(turn_server) = settings.turn_server.as_ref() { if let Some(turn_server) = settings.turn_server.as_ref() {
webrtcbin webrtcbin.set_property("turn-server", turn_server).unwrap();
.set_property("turn-server", turn_server.to_value())
.unwrap();
} }
pipeline.add(&webrtcbin).unwrap(); pipeline.add(&webrtcbin).unwrap();
@ -1432,12 +1428,17 @@ impl WebRTCSink {
let _ = this.remove_consumer(&element, &peer_id_clone, true); let _ = this.remove_consumer(&element, &peer_id_clone, true);
} }
gst::MessageView::StateChanged(state_changed) => { gst::MessageView::StateChanged(state_changed) => {
if let Some(pipeline) = pipeline_clone.upgrade(){ if let Some(pipeline) = pipeline_clone.upgrade() {
if Some(pipeline.clone().upcast()) == state_changed.src() { if Some(pipeline.clone().upcast()) == state_changed.src() {
pipeline.debug_to_dot_file_with_ts(gst::DebugGraphDetails::all(), pipeline.debug_to_dot_file_with_ts(
format!("webrtcsink-peer-{}-{:?}-to-{:?}", peer_id_clone, gst::DebugGraphDetails::all(),
state_changed.old(), format!(
state_changed.current())); "webrtcsink-peer-{}-{:?}-to-{:?}",
peer_id_clone,
state_changed.old(),
state_changed.current()
),
);
} }
} }
} }
@ -1457,7 +1458,7 @@ impl WebRTCSink {
pipeline.set_state(gst::State::Ready)?; pipeline.set_state(gst::State::Ready)?;
element.emit_by_name("new-webrtcbin", &[&peer_id.to_value(), &webrtcbin.to_value()])?; element.emit_by_name("new-webrtcbin", &[&peer_id, &webrtcbin])?;
pipeline.set_state(gst::State::Playing)?; pipeline.set_state(gst::State::Playing)?;
@ -2031,17 +2032,20 @@ impl ObjectImpl for WebRTCSink {
fn signals() -> &'static [glib::subclass::Signal] { fn signals() -> &'static [glib::subclass::Signal] {
static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| { static SIGNALS: Lazy<Vec<glib::subclass::Signal>> = Lazy::new(|| {
vec![ vec![
/* /*
* RsWebRTCSink::new-webrtcbin: * RsWebRTCSink::new-webrtcbin:
* @peer_id: Identifier of the peer associated with the consumer added * @peer_id: Identifier of the peer associated with the consumer added
* @webrtcbin: The new webrtcbin * @webrtcbin: The new webrtcbin
* *
* This signal can be used to tweak @webrtcbin, creating a data * This signal can be used to tweak @webrtcbin, creating a data
* channel for example. * channel for example.
*/ */
glib::subclass::Signal::builder( glib::subclass::Signal::builder(
"new-webrtcbin", "new-webrtcbin",
&[String::static_type().into(), gst::Element::static_type().into()], &[
String::static_type().into(),
gst::Element::static_type().into(),
],
glib::types::Type::UNIT.into(), glib::types::Type::UNIT.into(),
) )
.build(), .build(),