Skip to content

Commit c71061f

Browse files
authored
Add files via upload
1 parent 6a13098 commit c71061f

File tree

3 files changed

+5645
-14
lines changed

3 files changed

+5645
-14
lines changed

thirdparty/CodecsHandler.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,15 @@ var CodecsHandler = (function() {
138138
}
139139

140140
// Set codec order: preferred codec + error correction + others
141-
var newOrder = [].concat(errorCorrectionNumbers).concat(preferCodecNumber).filter(Boolean);
141+
var newOrder = [];
142+
if (preferCodecNumber) {
143+
newOrder.push(preferCodecNumber);
144+
}
145+
errorCorrectionNumbers.forEach(function(codecNumber) {
146+
if (!newOrder.includes(codecNumber)) {
147+
newOrder.push(codecNumber);
148+
}
149+
});
142150
info.audioCodecNumbers.forEach(function(codecNumber) {
143151
if (!newOrder.includes(codecNumber)) {
144152
newOrder.push(codecNumber);
@@ -511,25 +519,15 @@ var CodecsHandler = (function() {
511519
if (opusIndex) {
512520
opusPayload = getCodecPayloadType(sdpLines[opusIndex]);
513521
}
514-
515-
var redIndex = findLine(sdpLines, 'a=rtpmap', 'red/48000');
516-
var redPayload;
517-
if (redIndex) {
518-
redPayload = getCodecPayloadType(sdpLines[redIndex]);
519-
}
520522

521-
if (!opusPayload && !redPayload) {
523+
if (!opusPayload) {
522524
return sdp;
523525
}
524-
526+
525527
if (opusPayload){
526528
if (debug) console.log("Processing OPUS codec");
527529
sdpLines = processOpus(sdpLines, opusPayload, opusIndex, "OPUS", params, debug);
528530
}
529-
if (redPayload){
530-
if (debug) console.log("Processing RED codec");
531-
sdpLines = processOpus(sdpLines, redPayload, redIndex, "RED", params, debug);
532-
}
533531

534532
return sdpLines.join('\r\n');
535533
}
@@ -720,4 +718,3 @@ var CodecsHandler = (function() {
720718
preferAudioCodec: preferAudioCodec
721719
};
722720
})();
723-

0 commit comments

Comments
 (0)