Browse Source

fix(TPCUtils): handle missing codec in isRunningInSimulcastMode.

Aparently we call this for all tracks including for the audio tracks and it is failing with JS error. This leads to "participant unable to unmute".
dev0
Hristo Terezov 7 months ago
parent
commit
d4a47d0e8a
1 changed files with 11 additions and 6 deletions
  1. 11
    6
      modules/RTC/TPCUtils.js

+ 11
- 6
modules/RTC/TPCUtils.js View File

712
      * Returns a boolean indicating whether the video encoder is running in Simulcast mode, i.e., three encodings need
712
      * Returns a boolean indicating whether the video encoder is running in Simulcast mode, i.e., three encodings need
713
      * to be configured in 4:2:1 resolution order with temporal scalability.
713
      * to be configured in 4:2:1 resolution order with temporal scalability.
714
      *
714
      *
715
-     * @param {CodecMimeType} codec - The video codec in use.
715
+     * @param {CodecMimeType} videoCodec - The video codec in use.
716
      * @returns {boolean}
716
      * @returns {boolean}
717
      */
717
      */
718
-    isRunningInSimulcastMode(codec) {
719
-        return codec === CodecMimeType.VP8 // VP8 always
718
+    isRunningInSimulcastMode(videoCodec) {
719
+        if (!this.codecSettings || !this.codecSettings[videoCodec]) {
720
+            // If codec settings are not available, assume no simulcast
721
+            return false;
722
+        }
723
+
724
+        return videoCodec === CodecMimeType.VP8 // VP8 always
720
 
725
 
721
             // K-SVC mode for VP9 when no scalability mode is set. Though only one outbound-rtp stream is present,
726
             // K-SVC mode for VP9 when no scalability mode is set. Though only one outbound-rtp stream is present,
722
             // three separate encodings have to be configured.
727
             // three separate encodings have to be configured.
723
-            || (!this.codecSettings[codec].scalabilityModeEnabled && codec === CodecMimeType.VP9)
728
+            || (!this.codecSettings[videoCodec].scalabilityModeEnabled && videoCodec === CodecMimeType.VP9)
724
 
729
 
725
             // When scalability is enabled, always for H.264, and only when simulcast is explicitly enabled via
730
             // When scalability is enabled, always for H.264, and only when simulcast is explicitly enabled via
726
             // config.js for VP9 and AV1 since full SVC is the default mode for these 2 codecs.
731
             // config.js for VP9 and AV1 since full SVC is the default mode for these 2 codecs.
727
-            || (this.codecSettings[codec].scalabilityModeEnabled
728
-                && (codec === CodecMimeType.H264 || this.codecSettings[codec].useSimulcast));
732
+            || (this.codecSettings[videoCodec].scalabilityModeEnabled
733
+                && (videoCodec === CodecMimeType.H264 || this.codecSettings[videoCodec].useSimulcast));
729
     }
734
     }
730
 
735
 
731
     /**
736
     /**

Loading…
Cancel
Save