@@ -21,7 +21,7 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
2121 constructor ( params : VideoDecoderIssueDetectorParams = { } ) {
2222 super ( params ) ;
2323 this . #volatilityThreshold = params . volatilityThreshold ?? 8 ;
24- this . #affectedStreamsPercentThreshold = params . affectedStreamsPercentThreshold ?? 50 ;
24+ this . #affectedStreamsPercentThreshold = params . affectedStreamsPercentThreshold ?? 30 ;
2525 }
2626
2727 performDetection ( data : WebRTCStatsParsedWithNetworkScores ) : IssueDetectorResult {
@@ -65,12 +65,12 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
6565 const allFps : number [ ] = [ ] ;
6666
6767 // exclude first element to calculate accurate delta
68- for ( let i = 1 ; i < allProcessedStats . length ; i += 1 ) {
68+ for ( let i = 0 ; i < allProcessedStats . length - 1 ; i += 1 ) {
6969 const videoStreamStats = allProcessedStats [ i ] . video . inbound . find (
7070 ( stream ) => stream . ssrc === incomeVideoStream . ssrc ,
7171 ) ;
7272
73- if ( videoStreamStats ) {
73+ if ( videoStreamStats ?. framesPerSecond !== undefined ) {
7474 allFps . push ( videoStreamStats . framesPerSecond ) ;
7575 }
7676 }
@@ -82,19 +82,24 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
8282 const volatility = ( meanAbsoluteDeviationFps * 100 ) / meanFps ;
8383
8484 console . log ( 'THROTTLE' , {
85+ ssrc : incomeVideoStream . ssrc ,
8586 volatility,
8687 allFps,
8788 } ) ;
8889
8990 if ( volatility > this . #volatilityThreshold) {
90- console . log ( 'THROTTLE DETECTED on Single stream' ) ;
91+ console . log ( 'THROTTLE DETECTED on Single stream' , incomeVideoStream . ssrc ) ;
9192 return { ssrc : incomeVideoStream . ssrc , allFps, volatility } ;
9293 }
9394
9495 return undefined ;
9596 } )
9697 . filter ( ( throttledVideoStream ) => Boolean ( throttledVideoStream ) ) ;
9798
99+ if ( throtthedStreams . length === 0 ) {
100+ return issues ;
101+ }
102+
98103 const affectedStreamsPercent = throtthedStreams . length / ( data . video . inbound . length / 100 ) ;
99104 console . log ( 'THROTTLE AFFECTION' , { affectedStreamsPercent } ) ;
100105 if ( affectedStreamsPercent > this . #affectedStreamsPercentThreshold) {
0 commit comments