Browser console errors related to speaker stats + Jibri recorder

Hi there!)

I faced a lot of errors in the browser console related to speaker stats when the Jibri recorder started before the user joined the meeting.

Steps to reproduce:

  1. Start the conference
  2. Start the Jibri recorder
  3. Join the conference with another user (check browser console)

Error example:

2022-08-11T07:45:23.356Z [JitsiMeetJS.js] <Object.getGlobalOnErrorHandler>:  UnhandledError: Strophe: TypeError: Cannot set properties of undefined (setting 'totalDominantSpeakerTime')
    at Ld._updateStats (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:654474)
    at r.emit (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:81963)
    at Yo._onPrivateMessage (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:496839)
    at I.Handler.run (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:149528)
    at https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:157966
    at Object.forEachChild (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:141196)
    at I.Connection._dataRecv (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:157815)
    at O.Websocket._onMessage (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:187045) Script: null Line: null Column: null StackTrace:  Error: Strophe: TypeError: Cannot set properties of undefined (setting 'totalDominantSpeakerTime')
    at Ld._updateStats (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:654474)
    at r.emit (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:81963)
    at Yo._onPrivateMessage (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:496839)
    at I.Handler.run (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:149528)
    at https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:157966
    at Object.forEachChild (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:141196)
    at I.Connection._dataRecv (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:157815)
    at O.Websocket._onMessage (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:187045)
    at Object.Yo.ct.Strophe.log (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:484463)
    at Object.fatal (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:146461)
    at Object._handleError (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:145852)
    at I.Handler.run (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:149556)
    at https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:157966
    at Object.forEachChild (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:141196)
    at I.Connection._dataRecv (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:157815)
    at O.Websocket._onMessage (https://test.example.com/conf/libs/lib-jitsi-meet.min.js?v=328649:2:187045)

The root of the problem in the lib-jitsi-meet in class SpeakerStatsCollector._updateStats (see screenshot_1.png)

  1. speakerStatsToUpdate variable creates as undefined.
  2. Participant is found and it is the recorder (hidden participant).
  3. The IF statement was skipped because of conditions.
  4. We try to set the field and execute the method inside the “undefined” variable. → leads to error

The quick solution:
Move the last assignment and execution inside the IF statement

1 Like

Your reasoning sounds about right! Would you be so kind to create a PR?

Sorry, I don’t have a signed contributor license agreement.
Could you please help me with PR?
I have prepared a patch from the master branch (in attachment)

In filename “speaker_stats_collector_fix.patch.txt” need to remove the extension “.txt”. The forum doesn’t allow the “.patch” extension.

Thank you in advance)
speaker_stats_collector_fix.patch.txt (1.1 KB)

A pull request has been created
https://github.com/jitsi/lib-jitsi-meet/pull/2097

Thank you!