From 2e77beabc3f8512443f9f7aff0ebc1f985aa8d5c Mon Sep 17 00:00:00 2001 From: bel Date: Thu, 7 May 2020 20:42:11 -0600 Subject: [PATCH] about to rape webrtc.js --- pool.go | 2 -- public/webrtc.js | 20 ++++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pool.go b/pool.go index 51b49aa..5bbf81c 100644 --- a/pool.go +++ b/pool.go @@ -3,7 +3,6 @@ package main import ( "io" "io/ioutil" - "log" "sync" "github.com/gorilla/websocket" @@ -46,6 +45,5 @@ func (p *Pool) Broadcast(mt int, r io.Reader) error { } return true }) - log.Printf("%d writes, %d min size, %d wanted size", cnt, n, len(b)) return nil } diff --git a/public/webrtc.js b/public/webrtc.js index 580cc49..30ac9e6 100755 --- a/public/webrtc.js +++ b/public/webrtc.js @@ -72,7 +72,13 @@ function start(isCaller) { peerConnection.addStream(localStream); if(isCaller) { - peerConnection.createOffer().then(createdDescription).catch(errorHandler); + peerConnection + .createOffer({ + 'iceRestart': true, + 'voiceActivityDetection': true, + }) + .then(createdDescription) + .catch(errorHandler); } } @@ -105,9 +111,15 @@ function gotIceCandidate(event) { function createdDescription(description) { console.log('got description'); - peerConnection.setLocalDescription(description).then(function() { - serverConnection.send(JSON.stringify({'sdp': peerConnection.localDescription, 'uuid': uuid})); - }).catch(errorHandler); + peerConnection + .setLocalDescription(description) + .then(function() { + serverConnection.send(JSON.stringify({ + 'sdp': peerConnection.localDescription, + 'uuid': uuid, + })); + }) + .catch(errorHandler); } function gotRemoteStream(event) {