mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-18 09:57:48 +00:00
fix(connection-indicator) use SSRCs to match tiles to stats
This commit is contained in:
committed by
Saúl Ibarra Corretgé
parent
73160de3b7
commit
9b1e662a93
@@ -2,10 +2,9 @@
|
||||
|
||||
import { Component } from 'react';
|
||||
|
||||
import { getVirtualScreenshareParticipantOwnerId } from '../../base/participants/functions';
|
||||
import statsEmitter from '../statsEmitter';
|
||||
|
||||
declare var interfaceConfig: Object;
|
||||
|
||||
const defaultAutoHideTimeout = 5000;
|
||||
|
||||
/**
|
||||
@@ -26,6 +25,11 @@ export type Props = {
|
||||
*/
|
||||
_autoHideTimeout: number,
|
||||
|
||||
/**
|
||||
* Whether or not the statistics are for screen share.
|
||||
*/
|
||||
_isVirtualScreenshareParticipant: boolean,
|
||||
|
||||
/**
|
||||
* The ID of the participant associated with the displayed connection indication and
|
||||
* stats.
|
||||
@@ -90,7 +94,7 @@ class AbstractConnectionIndicator<P: Props, S: State> extends Component<P, S> {
|
||||
* returns {void}
|
||||
*/
|
||||
componentDidMount() {
|
||||
statsEmitter.subscribeToClientStats(this.props.participantId, this._onStatsUpdated);
|
||||
statsEmitter.subscribeToClientStats(this._getRealParticipantId(this.props), this._onStatsUpdated);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,11 +104,12 @@ class AbstractConnectionIndicator<P: Props, S: State> extends Component<P, S> {
|
||||
* returns {void}
|
||||
*/
|
||||
componentDidUpdate(prevProps: Props) {
|
||||
if (prevProps.participantId !== this.props.participantId) {
|
||||
statsEmitter.unsubscribeToClientStats(
|
||||
prevProps.participantId, this._onStatsUpdated);
|
||||
statsEmitter.subscribeToClientStats(
|
||||
this.props.participantId, this._onStatsUpdated);
|
||||
const prevParticipantId = this._getRealParticipantId(prevProps);
|
||||
const participantId = this._getRealParticipantId(this.props);
|
||||
|
||||
if (prevParticipantId !== participantId) {
|
||||
statsEmitter.unsubscribeToClientStats(prevParticipantId, this._onStatsUpdated);
|
||||
statsEmitter.subscribeToClientStats(participantId, this._onStatsUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,11 +121,25 @@ class AbstractConnectionIndicator<P: Props, S: State> extends Component<P, S> {
|
||||
* @returns {void}
|
||||
*/
|
||||
componentWillUnmount() {
|
||||
statsEmitter.unsubscribeToClientStats(this.props.participantId, this._onStatsUpdated);
|
||||
statsEmitter.unsubscribeToClientStats(this._getRealParticipantId(this.props), this._onStatsUpdated);
|
||||
|
||||
clearTimeout(this.autoHideTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the "real" participant ID. FOr a virtual screenshare participant, that is its "owner".
|
||||
*
|
||||
* @param {Props} props - The props where to extract the data from.
|
||||
* @returns {string | undefined } The resolved participant ID.
|
||||
*/
|
||||
_getRealParticipantId(props: Props) {
|
||||
if (props._isVirtualScreenshareParticipant) {
|
||||
return getVirtualScreenshareParticipantOwnerId(props.participantId);
|
||||
}
|
||||
|
||||
return props.participantId;
|
||||
}
|
||||
|
||||
_onStatsUpdated: (Object) => void;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user