bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/connection-status/modal/container.jsx
Paulo Lanzarin 327c2c4624
fix: run full RTC stats collection only when necessary (#21073)
In BBB 3.0, a change was made to collect full WebRTC stats continuously.
This method gathers stats from *all* peers and *all* senders and receivers
every 2 seconds. Originally, it was intended to run only when the user opened
the connection status dialog, providing in-depth info in the UI and making it
available for copying.

This new behavior is not ideal. Running full stats collection every 2 seconds
in meetings with 20+ peers/transceivers wastes client resources since the
collected data is unused 99% of the time.

This commit reverts to the pre-3.0 behavior (≤2.7), where full stats collection
(`startNetworkMonitoring`) runs only when the connection status modal is open.
As a bonus, it fixes the packet loss status transition log to use the packet
loss percentage, which is the actual trigger metric.
2024-09-13 09:15:35 -04:00

35 lines
1.3 KiB
JavaScript

import React from 'react';
import { CONNECTION_STATUS_REPORT_SUBSCRIPTION } from '../queries';
import {
sortConnectionData,
startMonitoringNetwork,
stopMonitoringNetwork,
} from '../service';
import Component from './component';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import useDeduplicatedSubscription from '/imports/ui/core/hooks/useDeduplicatedSubscription';
import { useReactiveVar } from '@apollo/client';
import connectionStatus from '/imports/ui/core/graphql/singletons/connectionStatus';
const ConnectionStatusContainer = (props) => {
const { data } = useDeduplicatedSubscription(CONNECTION_STATUS_REPORT_SUBSCRIPTION);
const connectionData = data ? sortConnectionData(data.user_connectionStatusReport) : [];
const { data: currentUser } = useCurrentUser((u) => ({ isModerator: u.isModerator }));
const amIModerator = !!currentUser?.isModerator;
const networkData = useReactiveVar(connectionStatus.getNetworkDataVar());
return (
<Component
{...props}
connectionData={connectionData}
amIModerator={amIModerator}
networkData={networkData}
startMonitoringNetwork={startMonitoringNetwork}
stopMonitoringNetwork={stopMonitoringNetwork}
/>
);
};
export default ConnectionStatusContainer;