Kaynağa Gözat

fix(TPC) Ignore codecSelection when codec settings are missing.

Fixes an issue with Spot screensharing since Spot uses a fake conference to create a connection for screensharing and codecSettings are undefined.
release-8443
Jaya Allamsetty 2 yıl önce
ebeveyn
işleme
8f836678fb
1 değiştirilmiş dosya ile 11 ekleme ve 1 silme
  1. 11
    1
      modules/RTC/TraceablePeerConnection.js

+ 11
- 1
modules/RTC/TraceablePeerConnection.js Dosyayı Görüntüle

@@ -1665,6 +1665,10 @@ TraceablePeerConnection.prototype._isSharingScreen = function() {
1665 1665
  * @returns {RTCSessionDescription} the munged description.
1666 1666
  */
1667 1667
 TraceablePeerConnection.prototype._mungeCodecOrder = function(description) {
1668
+    if (!this.codecSettings) {
1669
+        return description;
1670
+    }
1671
+
1668 1672
     const parsedSdp = transform.parse(description.sdp);
1669 1673
     const mLines = parsedSdp.media.filter(m => m.type === this.codecSettings.mediaType);
1670 1674
 
@@ -1928,6 +1932,9 @@ TraceablePeerConnection.prototype.setDesktopSharingFrameRate = function(maxFps)
1928 1932
  * @returns {void}
1929 1933
  */
1930 1934
 TraceablePeerConnection.prototype.setVideoCodecs = function(preferredCodec, disabledCodec) {
1935
+    if (!this.codecSettings) {
1936
+        return;
1937
+    }
1931 1938
     preferredCodec && (this.codecSettings.preferred = preferredCodec);
1932 1939
     disabledCodec && (this.codecSettings.disabled = disabledCodec);
1933 1940
 };
@@ -2423,6 +2430,9 @@ TraceablePeerConnection.prototype._initializeDtlsTransport = function() {
2423 2430
  * @returns RTCSessionDescription
2424 2431
  */
2425 2432
 TraceablePeerConnection.prototype._setVp9MaxBitrates = function(description, isLocalSdp = false) {
2433
+    if (!this.codecSettings) {
2434
+        return description;
2435
+    }
2426 2436
     const parsedSdp = transform.parse(description.sdp);
2427 2437
 
2428 2438
     // Find all the m-lines associated with the local sources.
@@ -2990,7 +3000,7 @@ TraceablePeerConnection.prototype._createOfferOrAnswer = function(
2990 3000
 
2991 3001
     // Set the codec preference before creating an offer or answer so that the generated SDP will have
2992 3002
     // the correct preference order.
2993
-    if (this._usesTransceiverCodecPreferences) {
3003
+    if (this._usesTransceiverCodecPreferences && this.codecSettings) {
2994 3004
         const { mediaType } = this.codecSettings;
2995 3005
         const transceivers = this.peerconnection.getTransceivers()
2996 3006
             .filter(t => t.receiver && t.receiver?.track?.kind === mediaType);

Loading…
İptal
Kaydet