Some small updates, related to firefox

canary
WolverinDEV 2020-11-25 23:41:32 +01:00
parent e9e8e2c69b
commit 18e44faf3c
3 changed files with 29 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -528,6 +528,16 @@ export class RTCConnection {
return this.retryTimestamp;
}
restartConnection() {
if(this.connectionState === RTPConnectionState.DISCONNECTED) {
/* We've been disconnected on purpose */
return;
}
this.reset(true);
this.doInitialSetup();
}
reset(updateConnectionState: boolean) {
if(this.peer) {
if(this.getConnection().connected()) {
@ -691,11 +701,16 @@ export class RTCConnection {
/* initialize rtc connection */
this.retryCalculator.reset();
if(!('RTCPeerConnection' in window)) {
if(!("RTCPeerConnection" in window)) {
this.handleFatalError(tr("WebRTC has been disabled (RTCPeerConnection is not defined)"), false);
return;
}
if(!("addTransceiver" in RTCPeerConnection.prototype)) {
this.handleFatalError(tr("WebRTC api incompatible (RTCPeerConnection.addTransceiver missing)"), false);
return;
}
this.peer = new RTCPeerConnection({
bundlePolicy: "max-bundle",
rtcpMuxPolicy: "require",

View File

@ -10,8 +10,8 @@ interface SdpCodec {
rtcpFb?: string[]
}
/* These MUST be the payloads used by the remote as well */
const OPUS_VOICE_PAYLOAD_TYPE = 111;
/* For optimal performance these payload formats should match the servers one */
const OPUS_VOICE_PAYLOAD_TYPE = 111
const OPUS_MUSIC_PAYLOAD_TYPE = 112;
const H264_PAYLOAD_TYPE = 126;
@ -24,6 +24,7 @@ type SdpMedia = {
export class SdpProcessor {
private static readonly kAudioCodecs: SdpCodec[] = [
/* Primary audio format */
{
/* Opus Mono/Opus Voice */
payload: OPUS_VOICE_PAYLOAD_TYPE,
@ -45,7 +46,6 @@ export class SdpProcessor {
];
private static readonly kVideoCodecs: SdpCodec[] = [
/* TODO: Set AS as well! */
{
payload: H264_PAYLOAD_TYPE,
codec: "H264",
@ -186,6 +186,15 @@ export class SdpProcessor {
media.maxptime = media.fmtp["maxptime"];
}
}
if(window.detectedBrowser.name === "firefox") {
/*
* Firefox does not support multiple payload formats not switching between them.
* This causes us only to add one, the primary, codec and hope for the best
* (Opus Stereo and Mono mixing seem to work right now 11.2020)
*/
break;
}
}
media.payloads = media.rtp.map(e => e.payload).join(" ");