Skip to content

Commit

Permalink
Pushes e2e pings to rtcstats (jitsi#11270)
Browse files Browse the repository at this point in the history
* Pushes e2e pings to rtcstats

* linter fixes

* linter fixes

* Re-use existing event instead of introducing a new one.

* Don't update the connection info popup stats when the e2e rtt changes.

* Bumps ljm version to the latest

* e2e pings should work on mobile

* tweak the e2eRttChanged action properties

* fixes comments
  • Loading branch information
gpolitis authored Apr 1, 2022
1 parent 1e58a7c commit 84ac629
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 22 deletions.
6 changes: 6 additions & 0 deletions conference.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
conferenceWillJoin,
conferenceWillLeave,
dataChannelOpened,
e2eRttChanged,
getConferenceOptions,
kickedOut,
lockStateChanged,
Expand All @@ -69,6 +70,7 @@ import {
JitsiConferenceEvents,
JitsiConnectionErrors,
JitsiConnectionEvents,
JitsiE2ePingEvents,
JitsiMediaDevicesEvents,
JitsiParticipantConnectionStatus,
JitsiTrackErrors,
Expand Down Expand Up @@ -2343,6 +2345,10 @@ export default {
APP.store.dispatch(setVideoUnmutePermissions(disableVideoMuteChange));
});

room.on(
JitsiE2ePingEvents.E2E_RTT_CHANGED,
(...args) => APP.store.dispatch(e2eRttChanged(...args)));

APP.UI.addListener(UIEvents.AUDIO_MUTED, muted => {
this.muteAudio(muted);
});
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"jquery-i18next": "1.2.1",
"js-md5": "0.6.1",
"jwt-decode": "2.2.0",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1409.0.0+88378583/lib-jitsi-meet.tgz",
"lib-jitsi-meet": "https://github.com/jitsi/lib-jitsi-meet/releases/download/v1410.0.0+3b38ab37/lib-jitsi-meet.tgz",
"libflacjs": "https://[email protected]/mmig/libflac.js#93d37e7f811f01cf7d8b6a603e38bd3c3810907d",
"lodash": "4.17.21",
"moment": "2.29.1",
Expand Down
13 changes: 13 additions & 0 deletions react/features/base/conference/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ export const CONFERENCE_TIMESTAMP_CHANGED = 'CONFERENCE_TIMESTAMP_CHANGED';
*/
export const CONFERENCE_UNIQUE_ID_SET = 'CONFERENCE_UNIQUE_ID_SET';

/**
* The type of (redux) action which signals that the end-to-end RTT against a specific remote participant has changed.
*
* {
* type: E2E_RTT_CHANGED,
* e2eRtt: {
* rtt: number,
* participant: Object,
* }
* }
*/
export const E2E_RTT_CHANGED = 'E2E_RTT_CHANGED'

/**
* The type of (redux) action which signals that a specific conference will be
* joined.
Expand Down
31 changes: 30 additions & 1 deletion react/features/base/conference/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { endpointMessageReceived } from '../../subtitles';
import { getReplaceParticipant } from '../config/functions';
import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
import { JitsiConferenceEvents } from '../lib-jitsi-meet';
import { JitsiConferenceEvents, JitsiE2ePingEvents } from '../lib-jitsi-meet';
import {
MEDIA_TYPE,
setAudioMuted,
Expand Down Expand Up @@ -48,6 +48,7 @@ import {
CONFERENCE_WILL_JOIN,
CONFERENCE_WILL_LEAVE,
DATA_CHANNEL_OPENED,
E2E_RTT_CHANGED,
KICKED_OUT,
LOCK_STATE_CHANGED,
NON_PARTICIPANT_MESSAGE_RECEIVED,
Expand Down Expand Up @@ -231,6 +232,10 @@ function _addConferenceListeners(conference, dispatch, state) {
JitsiConferenceEvents.USER_STATUS_CHANGED,
(...args) => dispatch(participantPresenceChanged(...args)));

conference.on(
JitsiE2ePingEvents.E2E_RTT_CHANGED,
(...args) => dispatch(e2eRttChanged(...args)));

conference.on(
JitsiConferenceEvents.BOT_TYPE_CHANGED,
(id, botType) => dispatch(participantUpdated({
Expand All @@ -255,6 +260,30 @@ function _addConferenceListeners(conference, dispatch, state) {
})));
}


/**
* Create an action for when the end-to-end RTT against a specific remote participant has changed.
*
* @param {Object} participant - The participant against which the rtt is measured.
* @param {number} rtt - The rtt.
* @returns {{
* type: E2E_RTT_CHANGED,
* e2eRtt: {
* participant: Object,
* rtt: number
* }
* }}
*/
export function e2eRttChanged(participant, rtt) {
return {
type: E2E_RTT_CHANGED,
e2eRtt: {
rtt,
participant
}
};
}

/**
* Updates the current known state of server-side authentication.
*
Expand Down
2 changes: 1 addition & 1 deletion react/features/base/participants/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ export const RAISE_HAND_UPDATED = 'RAISE_HAND_UPDATED';
* level: number
* }
*/
export const LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED = 'LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED'
export const LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED = 'LOCAL_PARTICIPANT_AUDIO_LEVEL_CHANGED'
14 changes: 1 addition & 13 deletions react/features/connection-indicator/statsEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
import _ from 'lodash';

import {
JitsiConnectionQualityEvents,
JitsiE2ePingEvents
JitsiConnectionQualityEvents
} from '../base/lib-jitsi-meet';

/**
Expand Down Expand Up @@ -34,17 +33,6 @@ const statsEmitter = {

conference.on(JitsiConnectionQualityEvents.REMOTE_STATS_UPDATED,
(id, stats) => this._emitStatsUpdate(id, stats));

conference.on(
JitsiE2ePingEvents.E2E_RTT_CHANGED,
(participant, e2eRtt) => {
const stats = {
e2eRtt,
region: participant.getProperty('region')
};

this._emitStatsUpdate(participant.getId(), stats);
});
},

/**
Expand Down
10 changes: 10 additions & 0 deletions react/features/rtcstats/RTCStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ class RTCStats {
this.trace && this.trace.statsEntry('dominantSpeaker', null, dominantSpeakerData);
}

/**
* Send e2e rtt data, the data will be processed by rtcstats-server and saved in the dump file.
*
* @param {Object} e2eRttData - The object that holds the e2e data.
* @returns {void}
*/
sendE2eRttData(e2eRttData) {
this.trace && this.trace.statsEntry('e2eRtt', null, e2eRttData);
}

/**
* Send facial expression data, the data will be processed by rtcstats-server and saved in the dump file.
*
Expand Down
14 changes: 13 additions & 1 deletion react/features/rtcstats/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { jitsiLocalStorage } from '@jitsi/js-utils';

import { getAmplitudeIdentity } from '../analytics';
import { CONFERENCE_UNIQUE_ID_SET, getConferenceOptions, getRoomName } from '../base/conference';
import { CONFERENCE_UNIQUE_ID_SET, E2E_RTT_CHANGED, getConferenceOptions, getRoomName } from '../base/conference';
import { LIB_WILL_INIT } from '../base/lib-jitsi-meet';
import { DOMINANT_SPEAKER_CHANGED, getLocalParticipant } from '../base/participants';
import { MiddlewareRegistry } from '../base/redux';
Expand Down Expand Up @@ -105,6 +105,18 @@ MiddlewareRegistry.register(store => next => action => {
}
break;
}
case E2E_RTT_CHANGED: {
if (canSendRtcstatsData(state)) {
const { participant, rtt } = action.e2eRtt;

RTCStats.sendE2eRttData({
remoteEndpointId: participant.getId(),
rtt,
remoteRegion: participant.getProperty('region')
});
}
break;
}
case ADD_FACIAL_EXPRESSION: {
if (canSendRtcstatsData(state)) {
const { duration, facialExpression } = action;
Expand Down

0 comments on commit 84ac629

Please sign in to comment.