Some minor changed related to the WebRTC bridge
This commit is contained in:
parent
fbec274c07
commit
37bd67af85
1 changed files with 23 additions and 2 deletions
|
@ -398,6 +398,8 @@ export class VoiceConnection extends AbstractVoiceConnection {
|
||||||
sdpConstraints.offerToReceiveVideo = false;
|
sdpConstraints.offerToReceiveVideo = false;
|
||||||
sdpConstraints.voiceActivityDetection = true;
|
sdpConstraints.voiceActivityDetection = true;
|
||||||
|
|
||||||
|
this.rtcPeerConnection.onicegatheringstatechange = () => console.log("ICE gathering state changed to %s", this.rtcPeerConnection.iceGatheringState);
|
||||||
|
this.rtcPeerConnection.oniceconnectionstatechange = () => console.log("ICE connection state changed to %s", this.rtcPeerConnection.iceConnectionState);
|
||||||
this.rtcPeerConnection.onicecandidate = this.on_local_ice_candidate.bind(this);
|
this.rtcPeerConnection.onicecandidate = this.on_local_ice_candidate.bind(this);
|
||||||
if(this.local_audio_stream) { //May a typecheck?
|
if(this.local_audio_stream) { //May a typecheck?
|
||||||
this.rtcPeerConnection.addStream(this.local_audio_stream.stream);
|
this.rtcPeerConnection.addStream(this.local_audio_stream.stream);
|
||||||
|
@ -442,6 +444,13 @@ export class VoiceConnection extends AbstractVoiceConnection {
|
||||||
log.info(LogCategory.VOICE, tr("Failed to add remote cached ice candidate %s: %o"), msg, error);
|
log.info(LogCategory.VOICE, tr("Failed to add remote cached ice candidate %s: %o"), msg, error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log("Applying finish notification");
|
||||||
|
this.rtcPeerConnection.addIceCandidate(new RTCIceCandidate({ candidate: "", sdpMLineIndex: 0, sdpMid: "0" })).catch(error => {
|
||||||
|
log.info(LogCategory.VOICE, tr("Failed to add signal a ICE candidate finish: %o"), error);
|
||||||
|
});
|
||||||
|
this.rtcPeerConnection.addIceCandidate(new RTCIceCandidate({ candidate: "", sdpMLineIndex: 1, sdpMid: "1" })).catch(error => {
|
||||||
|
log.info(LogCategory.VOICE, tr("Failed to add signal a ICE candidate finish: %o"), error);
|
||||||
|
});
|
||||||
this._ice_cache = [];
|
this._ice_cache = [];
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
log.info(LogCategory.VOICE, tr("Failed to apply remote description: %o"), error); //FIXME error handling!
|
log.info(LogCategory.VOICE, tr("Failed to apply remote description: %o"), error); //FIXME error handling!
|
||||||
|
@ -456,6 +465,16 @@ export class VoiceConnection extends AbstractVoiceConnection {
|
||||||
log.info(LogCategory.VOICE, tr("Cache remote ice! (%o)"), json["msg"]);
|
log.info(LogCategory.VOICE, tr("Cache remote ice! (%o)"), json["msg"]);
|
||||||
this._ice_cache.push(json["msg"]);
|
this._ice_cache.push(json["msg"]);
|
||||||
}
|
}
|
||||||
|
} else if(json["request"] === "ice_finish") {
|
||||||
|
if(!this._ice_use_cache) {
|
||||||
|
log.info(LogCategory.VOICE, tr("Remote signalled ice candidate finished: %o"), json["msg"]);
|
||||||
|
this.rtcPeerConnection.addIceCandidate(new RTCIceCandidate(json["msg"])).catch(error => {
|
||||||
|
log.info(LogCategory.VOICE, tr("Failed to add signal a ICE candidate finish: %o"), error);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
log.info(LogCategory.VOICE, tr("Cache remote ice finish."));
|
||||||
|
this._ice_cache.push(json["msg"]);
|
||||||
|
}
|
||||||
} else if(json["request"] == "status") {
|
} else if(json["request"] == "status") {
|
||||||
if(json["state"] == "failed") {
|
if(json["state"] == "failed") {
|
||||||
const chandler = this.connection.client;
|
const chandler = this.connection.client;
|
||||||
|
@ -469,13 +488,15 @@ export class VoiceConnection extends AbstractVoiceConnection {
|
||||||
}
|
}
|
||||||
//TODO handle fail specially when its not allowed to reconnect
|
//TODO handle fail specially when its not allowed to reconnect
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.warn(LogCategory.NETWORKING, tr("Received unknown web client control packet: %s"), json["request"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private on_local_ice_candidate(event: RTCPeerConnectionIceEvent) {
|
private on_local_ice_candidate(event: RTCPeerConnectionIceEvent) {
|
||||||
if (event) {
|
if (event) {
|
||||||
//if(event.candidate && event.candidate.protocol !== "udp")
|
if(event.candidate && event.candidate.protocol !== "udp")
|
||||||
// return;
|
return;
|
||||||
|
|
||||||
log.info(LogCategory.VOICE, tr("Gathered local ice candidate %o."), event.candidate);
|
log.info(LogCategory.VOICE, tr("Gathered local ice candidate %o."), event.candidate);
|
||||||
if(event.candidate) {
|
if(event.candidate) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue