Browse Source

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 years ago
parent
commit
8f836678fb
1 changed files with 11 additions and 1 deletions
  1. 11
    1
      modules/RTC/TraceablePeerConnection.js

+ 11
- 1
modules/RTC/TraceablePeerConnection.js View File

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

Loading…
Cancel
Save