@@ -95,12 +95,19 @@ class WebRTCIssueDetector {
9595 this . calculateNetworkScores ( report . stats ) ;
9696 } ) ;
9797
98- this . statsReporter . on ( PeriodicWebRTCStatsReporter . STATS_REPORTS_PARSED , ( data : { timeTaken : number } ) => {
98+ this . statsReporter . on ( PeriodicWebRTCStatsReporter . STATS_REPORTS_PARSED , ( data : {
99+ timeTaken : number ,
100+ reportItems : StatsReportItem [ ] ,
101+ } ) => {
99102 const payload = {
100103 timeTaken : data . timeTaken ,
101104 ts : Date . now ( ) ,
102105 } ;
103106
107+ if ( params . onStats ) {
108+ params . onStats ( data . reportItems ) ;
109+ }
110+
104111 this . eventEmitter . emit ( EventType . StatsParsingFinished , payload ) ;
105112 } ) ;
106113 }
@@ -133,7 +140,7 @@ class WebRTCIssueDetector {
133140 this . statsReporter . stopReporting ( ) ;
134141 }
135142
136- public handleNewPeerConnection ( pc : RTCPeerConnection ) : void {
143+ public handleNewPeerConnection ( pc : RTCPeerConnection , id ?: string ) : void {
137144 if ( ! this . #running && this . autoAddPeerConnections ) {
138145 this . logger . debug ( 'Skip handling new peer connection. Detector is not running' , pc ) ;
139146 return ;
@@ -147,7 +154,7 @@ class WebRTCIssueDetector {
147154
148155 this . logger . debug ( 'Handling new peer connection' , pc ) ;
149156
150- this . compositeStatsParser . addPeerConnection ( { pc } ) ;
157+ this . compositeStatsParser . addPeerConnection ( { pc, id } ) ;
151158 }
152159
153160 private emitIssues ( issues : IssuePayload [ ] ) : void {
0 commit comments