From 8ff24e125e3a4fd9df7c1c8ee2d7c41c2b50f239 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Thu, 13 Jun 2019 20:51:26 +0300 Subject: [PATCH] Fix the getIPs() function Noticed it stopped working on Chrome. Was using a stun server (due to copy paste from the reference link) when one was not actually needed to create the RTCPeerConnection --- main.cpp | 2 +- main.js | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/main.cpp b/main.cpp index 8b60d0d..da1cd38 100644 --- a/main.cpp +++ b/main.cpp @@ -782,7 +782,7 @@ int init() { devid_in = 0; } else { - printf("Obtained spec for input device (SDL Id = %d):\n", devid_out); + printf("Obtained spec for input device (SDL Id = %d):\n", devid_in); printf(" - Sample rate: %d\n", captureSpec.freq); printf(" - Format: %d (required: %d)\n", captureSpec.format, desiredSpec.format); printf(" - Channels: %d (required: %d)\n", captureSpec.channels, desiredSpec.channels); diff --git a/main.js b/main.js index 6891184..472474d 100644 --- a/main.js +++ b/main.js @@ -112,15 +112,8 @@ function getIPs(callback){ useWebKit = !!win.webkitRTCPeerConnection; } - //minimal requirements for data connection - var mediaConstraints = { - optional: [{RtpDataChannels: true}] - }; - - var servers = {iceServers: [{urls: "stun:stun.services.mozilla.com"}]}; - //construct a new RTCPeerConnection - var pc = new RTCPeerConnection(servers, mediaConstraints); + var pc = new RTCPeerConnection(null); function handleCandidate(candidate){ //match just the IP address @@ -289,7 +282,7 @@ function senderInit() { senderPC = new RTCPeerConnection(null); senderPC.oniceconnectionstatechange = function(e) { - var state = senderPC.iceConnectionState; + //var state = senderPC.iceConnectionState; }; senderPC.onicecandidate = function(e) {