Commit d8d1cd09 authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

Filter out MDNS local ICE candidates

They're useless most of the time and seem to delay Firefox/Chrome when
trying to resolve them.
parent 2de43b7d
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -322,6 +322,17 @@ impl Publisher {
                    "Publisher {} sent ICE candidate {} at mline index {}",
                    self.remote_addr, candidate, sdp_mline_index
                );

                // Filter out MDNS local candidates. They're useless most of the time and seem to
                // delay Firefox/Chrome when trying to resolve them
                let split_candidate = candidate.splitn(7, ' ').collect::<Vec<_>>();
                if let Some(dest) = split_candidate.get(4) {
                    if dest.ends_with(".local") {
                        debug!("Skipping MDNS local candidate");
                        return;
                    }
                }

                self.webrtcbin
                    .emit("add-ice-candidate", &[&sdp_mline_index, &candidate])
                    .unwrap();
@@ -517,6 +528,16 @@ impl Actor for Publisher {
                let candidate = args[2].get::<String>().expect("Invalid argument").unwrap();

                if let Some(addr) = addr.upgrade() {
                    // Filter out MDNS local candidates. They're useless most of the time and seem to
                    // delay Firefox/Chrome when trying to resolve them
                    let split_candidate = candidate.splitn(7, ' ').collect::<Vec<_>>();
                    if let Some(dest) = split_candidate.get(4) {
                        if dest.ends_with(".local") {
                            debug!("Skipping MDNS local candidate");
                            return None;
                        }
                    }

                    addr.do_send(ICECandidateMessage {
                        candidate,
                        sdp_mline_index,
+21 −0
Original line number Diff line number Diff line
@@ -324,6 +324,17 @@ impl Subscriber {
                    "Subscriber {} sent ICE candidate {} at mline index {}",
                    self.remote_addr, candidate, sdp_mline_index
                );

                // Filter out MDNS local candidates. They're useless most of the time and seem to
                // delay Firefox/Chrome when trying to resolve them
                let split_candidate = candidate.splitn(7, ' ').collect::<Vec<_>>();
                if let Some(dest) = split_candidate.get(4) {
                    if dest.ends_with(".local") {
                        debug!("Skipping MDNS local candidate");
                        return;
                    }
                }

                self.webrtcbin
                    .emit("add-ice-candidate", &[&sdp_mline_index, &candidate])
                    .unwrap();
@@ -430,6 +441,16 @@ impl Actor for Subscriber {
                let sdp_mline_index = args[1].get_some::<u32>().expect("Invalid argument");
                let candidate = args[2].get::<String>().expect("Invalid argument").unwrap();

                // Filter out MDNS local candidates. They're useless most of the time and seem to
                // delay Firefox/Chrome when trying to resolve them
                let split_candidate = candidate.splitn(7, ' ').collect::<Vec<_>>();
                if let Some(dest) = split_candidate.get(4) {
                    if dest.ends_with(".local") {
                        debug!("Skipping MDNS local candidate");
                        return None;
                    }
                }

                if let Some(addr) = addr.upgrade() {
                    addr.do_send(ICECandidateMessage {
                        candidate,