@@ -53,6 +53,8 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
5353 const throtthedStreams = data . video . inbound
5454 . map ( ( incomeVideoStream ) : { ssrc : number , allDecodeTimePerFrame : number [ ] , volatility : number } | undefined => {
5555 const allDecodeTimePerFrame : number [ ] = [ ] ;
56+ const allFpss : number [ ] = [ ] ;
57+
5658 const isSpatialLayerChanged = isSvcSpatialLayerChanged ( incomeVideoStream . ssrc , allProcessedStats ) ;
5759 if ( isSpatialLayerChanged ) {
5860 return undefined ;
@@ -91,9 +93,10 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
9193 }
9294
9395 allDecodeTimePerFrame . push ( decodeTimePerFrame ) ;
96+ allFpss . push ( videoStreamStats . framesPerSecond ) ;
9497 }
9598
96- // Calculate volatility
99+ // Calculate volatility decode time
97100 const mean = allDecodeTimePerFrame . reduce ( ( acc , val ) => acc + val , 0 ) / allDecodeTimePerFrame . length ;
98101 const squaredDiffs = allDecodeTimePerFrame . map ( ( val ) => ( val - mean ) ** 2 ) ;
99102 const variance = squaredDiffs . reduce ( ( acc , val ) => acc + val , 0 ) / squaredDiffs . length ;
@@ -103,10 +106,16 @@ class VideoDecoderIssueDetector extends BaseIssueDetector {
103106 ( decodeTimePerFrame , index ) => index === 0 || decodeTimePerFrame > allDecodeTimePerFrame [ index - 1 ] ,
104107 ) ;
105108
109+
110+ // Calculate volatility fps
111+ const meanFps = allFpss . reduce ( ( acc , val ) => acc + val , 0 ) / allDecodeTimePerFrame . length ;
112+ const squaredDiffsFps = allFpss . map ( ( val ) => ( val - meanFps ) ** 2 ) ;
113+ const varianceFps = squaredDiffsFps . reduce ( ( acc , val ) => acc + val , 0 ) / squaredDiffsFps . length ;
114+ const volatilityFps = Math . sqrt ( varianceFps ) ;
115+
106116 console . log ( 'THROTTLE' , {
107- isDecodeTimePerFrameIncrease,
108- volatility,
109- mean,
117+ volatilityFps,
118+ allFpss,
110119 } ) ;
111120
112121 if ( volatility > this . #volatilityThreshold && isDecodeTimePerFrameIncrease ) {
0 commit comments