fn listen_for_local_candidates(webrtcbin: &gst::Element, sender: Sender<IceCandidate>) {
    let shared_sender = Mutex::new(sender);

    // wire up a candidate receiver
    webrtcbin
        .connect("on-ice-candidate", false, move |values| {
            let _webrtc = values[0]
                .get::<gst::Element>()
                .expect("Invalid argument")
                .expect("Should never be null.");
            let mlineindex = values[1].get_some::<u32>().expect("Invalid argument");
            let candidate_raw = values[2]
                .get::<String>()
                .expect("Invalid argument")
                .unwrap();

            let candidate = IceCandidate::new(mlineindex, candidate_raw.clone());

            info!(
                "Gathered local ice candidate. mlineindex={}, candidate={}",
                mlineindex, candidate_raw
            );

            let send_result = shared_sender.lock().unwrap().send(candidate);

            if let Err(_) = send_result {
                debug!("Could not send ice candidate. Receiver closed?");
            }

            None
        })
        .unwrap();
}
/// Listens for the gathering of local ice candidates
Listens for the gathering of local ice candidates
Listens for the gathering of local ice candidates
fn listen_for_local_candidates(webrtcbin: &gst::Element, sender: Sender<IceCandidate>) {
    let shared_sender = Mutex::new(sender);
    // wire up a candidate receiver
    webrtcbin
        .connect("on-ice-candidate", false, move |values| {
            let _webrtc = values[0]
                .get::<gst::Element>()
                .expect("Invalid argument")
                .expect("Should never be null.");
            let mlineindex = values[1].get_some::<u32>().expect("Invalid argument");
            let candidate_raw = values[2]
                .get::<String>()
                .expect("Invalid argument")
                .unwrap();
            let candidate = IceCandidate::new(mlineindex, candidate_raw.clone());
            info!(
                "Gathered local ice candidate. mlineindex={}, candidate={}",
                mlineindex, candidate_raw
            );
            let send_result = shared_sender.lock().unwrap().send(candidate);
            if let Err(_) = send_result {
                debug!("Could not send ice candidate. Receiver closed?");
            }
            None
        })
        .unwrap();
}
fn listen_for_local_candidates ( webrtcbin : & gst :: Element , sender : Sender < IceCandidate > ) { let shared_sender = Mutex :: new ( sender ) ; // wire up a candidate receiver webrtcbin . connect ( " " , false , move | values | { let _webrtc = values [ 0 ] . get :: < gst :: Element > ( ) . expect ( " " ) . expect ( " " ) ; let mlineindex = values [ 1 ] . get_some :: < u32 > ( ) . expect ( " " ) ; let candidate_raw = values [ 2 ] . get :: < String > ( ) . expect ( " " ) . unwrap ( ) ; let candidate = IceCandidate :: new ( mlineindex , candidate_raw . clone ( ) ) ; info ! ( " " mlineindex candidate_raw ) ; let send_result = shared_sender . lock ( ) . unwrap ( ) . send ( candidate ) ; if let Err ( _ ) = send_result { debug ! ( " " ) ; } None } ) . unwrap ( ) ; }
Listens for the gathering of local ice candidates
Listens for the gathering of local ice candidates
webrtcbin
&gst::Element
sender
Sender<IceCandidate>
webrtcbin
&gst::Element
sender
Sender<IceCandidate>