1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-23 00:55:58 +01:00

Rename Connection to Stream in the JS code.

This commit is contained in:
Juliusz Chroboczek 2020-08-12 12:50:28 +02:00
parent 675035ab29
commit b6adc0b9a8

View file

@ -34,7 +34,7 @@ function randomid() {
return toHex(a); return toHex(a);
} }
function Connection(id, pc) { function Stream(id, pc) {
this.id = id; this.id = id;
this.kind = null; this.kind = null;
this.label = null; this.label = null;
@ -47,11 +47,11 @@ function Connection(id, pc) {
this.stats = {}; this.stats = {};
} }
Connection.prototype.setInterval = function(f, t) { Stream.prototype.setInterval = function(f, t) {
this.timers.push(setInterval(f, t)); this.timers.push(setInterval(f, t));
}; };
Connection.prototype.close = function(sendit) { Stream.prototype.close = function(sendit) {
while(this.timers.length > 0) while(this.timers.length > 0)
clearInterval(this.timers.pop()); clearInterval(this.timers.pop());
@ -492,7 +492,7 @@ function setMedia(id) {
mine = false; mine = false;
} }
if(!c) if(!c)
throw new Error('Unknown connection'); throw new Error('Unknown stream');
let peersdiv = document.getElementById('peers'); let peersdiv = document.getElementById('peers');
@ -750,7 +750,7 @@ async function gotOffer(id, labels, offer, renegotiate) {
let pc = new RTCPeerConnection({ let pc = new RTCPeerConnection({
iceServers: iceServers, iceServers: iceServers,
}); });
c = new Connection(id, pc); c = new Stream(id, pc);
down[id] = c; down[id] = c;
c.pc.onicecandidate = function(e) { c.pc.onicecandidate = function(e) {
@ -861,7 +861,7 @@ function send(m) {
throw(new Error('Sending null message')); throw(new Error('Sending null message'));
if(socket.readyState !== socket.OPEN) { if(socket.readyState !== socket.OPEN) {
// send on a closed connection doesn't throw // send on a closed connection doesn't throw
throw(new Error('Connection is not open')); throw(new Error('Stream is not open'));
} }
return socket.send(JSON.stringify(m)); return socket.send(JSON.stringify(m));
} }
@ -1205,7 +1205,7 @@ async function newUpStream(id) {
if(up[id]) { if(up[id]) {
up[id].close(false); up[id].close(false);
} }
up[id] = new Connection(id, pc); up[id] = new Stream(id, pc);
pc.onnegotiationneeded = async e => { pc.onnegotiationneeded = async e => {
try { try {
@ -1246,7 +1246,7 @@ async function newUpStream(id) {
async function negotiate(id, restartIce) { async function negotiate(id, restartIce) {
let c = up[id]; let c = up[id];
if(!c) if(!c)
throw new Error('unknown connection'); throw new Error('unknown stream');
if(typeof(c.pc.getTransceivers) !== 'function') if(typeof(c.pc.getTransceivers) !== 'function')
throw new Error('Browser too old, please upgrade'); throw new Error('Browser too old, please upgrade');