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

Handle client-side errors during negotiation.

This commit is contained in:
Juliusz Chroboczek 2020-06-10 14:34:43 +02:00
parent 0308719719
commit d3655b8955

View file

@ -736,7 +736,14 @@ async function gotAnswer(id, answer) {
let c = up[id]; let c = up[id];
if(!c) if(!c)
throw new Error('unknown up stream'); throw new Error('unknown up stream');
await c.pc.setRemoteDescription(answer); try {
await c.pc.setRemoteDescription(answer);
} catch(e) {
console.error(e);
displayError(e);
delUpMedia(id);
return;
}
await addIceCandidates(c); await addIceCandidates(c);
} }
@ -1117,7 +1124,15 @@ async function newUpStream() {
throw new Error("Couldn't create peer connection"); throw new Error("Couldn't create peer connection");
up[id] = new Connection(id, pc); up[id] = new Connection(id, pc);
pc.onnegotiationneeded = e => negotiate(id); pc.onnegotiationneeded = async e => {
try {
await negotiate(id);
} catch(e) {
console.error(e);
displayError(e);
delUpMedia(id);
}
}
pc.onicecandidate = function(e) { pc.onicecandidate = function(e) {
if(!e.candidate) if(!e.candidate)