Skip to content

Commit

Permalink
feat: Displays the E2E RTT in the connection stats table. (#3344)
Browse files Browse the repository at this point in the history
* feat: Displays the E2E RTT in the connection stats table.

* fix: Whitelists the ping config properties.

* ref: Addresses feedback.

* npm: Updates lib-jitsi-meet to e097a1189ed99838605d90b959e129155bc0e50a.

* ref: Moves the e2ertt and region to the existing stats object.
  • Loading branch information
bgrozev authored and virtuacoplenny committed Aug 7, 2018
1 parent 7e1d976 commit 2ee1bf9
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 10 deletions.
12 changes: 12 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,18 @@ var config = {
// userRegion: "asia"
}

// Options related to end-to-end (participant to participant) ping.
// e2eping: {
// // The interval in milliseconds at which pings will be sent.
// // Defaults to 10000, set to <= 0 to disable.
// pingInterval: 10000,
//
// // The interval in milliseconds at which analytics events
// // with the measured RTT will be sent. Defaults to 60000, set
// // to <= 0 to disable.
// analyticsInterval: 60000,
// }

// List of undocumented settings used in jitsi-meet
/**
_immediateReloadThreshold
Expand Down
1 change: 1 addition & 0 deletions lang/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
"packetloss": "Packet loss:",
"resolution": "Resolution:",
"framerate": "Frame rate:",
"e2e_rtt": "E2E RTT:",
"less": "Show less",
"more": "Show more",
"address": "Address:",
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 @@ -47,7 +47,7 @@
"js-md5": "0.6.1",
"jsc-android": "224109.1.0",
"jwt-decode": "2.2.0",
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#2be752fc88ff71e454c6b9178b21a33b59c53f41",
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#e097a1189ed99838605d90b959e129155bc0e50a",
"lodash": "4.17.4",
"moment": "2.19.4",
"moment-duration-format": "2.2.2",
Expand Down
1 change: 1 addition & 0 deletions react/features/base/config/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const WHITELISTED_KEYS = [
'disableRtx',
'disableSuspendVideo',
'displayJids',
'e2eping',
'enableDisplayNameInStats',
'enableLayerSuspension',
'enableLipSync',
Expand Down
1 change: 1 addition & 0 deletions react/features/base/lib-jitsi-meet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const JitsiConnectionErrors = JitsiMeetJS.errors.connection;
export const JitsiConnectionEvents = JitsiMeetJS.events.connection;
export const JitsiConnectionQualityEvents
= JitsiMeetJS.events.connectionQuality;
export const JitsiE2ePingEvents = JitsiMeetJS.events.e2eping;
export const JitsiMediaDevicesEvents = JitsiMeetJS.events.mediaDevices;
export const JitsiParticipantConnectionStatus
= JitsiMeetJS.constants.participantConnectionStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ class ConnectionIndicator extends Component {
* @returns {void}
*/
_onStatsUpdated(stats = {}) {
// Rely on React to batch setState actions.
const { connectionQuality } = stats;
const newPercentageState = typeof connectionQuality === 'undefined'
? {} : { percent: connectionQuality };
Expand All @@ -337,7 +338,6 @@ class ConnectionIndicator extends Component {
stats: newStats
});

// Rely on React to batch setState actions.
this._updateIndicatorAutoHide(newStats.percent);
}

Expand Down Expand Up @@ -410,8 +410,10 @@ class ConnectionIndicator extends Component {
const {
bandwidth,
bitrate,
e2eRtt,
framerate,
packetLoss,
region,
resolution,
transport
} = this.state.stats;
Expand All @@ -421,10 +423,12 @@ class ConnectionIndicator extends Component {
bandwidth = { bandwidth }
bitrate = { bitrate }
connectionSummary = { this._getConnectionStatusTip() }
e2eRtt = { e2eRtt }
framerate = { framerate }
isLocalVideo = { this.props.isLocalVideo }
onShowMore = { this._onToggleShowMore }
packetLoss = { packetLoss }
region = { region }
resolution = { resolution }
shouldShowMore = { this.state.showMoreStats }
transport = { transport } />
Expand Down
16 changes: 15 additions & 1 deletion react/features/connection-indicator/statsEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import _ from 'lodash';

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

declare var APP: Object;

Expand Down Expand Up @@ -33,6 +36,17 @@ 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
38 changes: 36 additions & 2 deletions react/features/connection-stats/components/ConnectionStatsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,20 @@ class ConnectionStatsTable extends Component {
connectionSummary: PropTypes.string,

/**
* Statistics related to framerates for each ssrc.
* The end-to-end round-trip-time.
*/
e2eRtt: PropTypes.number,

/**
* Statistics related to frame rates for each ssrc.
* {{
* [ ssrc ]: Number
* }}
*/
framerate: PropTypes.object,

/**
* Whether or not the statitics are for local video.
* Whether or not the statistics are for local video.
*/
isLocalVideo: PropTypes.bool,

Expand All @@ -65,6 +70,11 @@ class ConnectionStatsTable extends Component {
*/
packetLoss: PropTypes.object,

/**
* The region.
*/
region: PropTypes.string,

/**
* Statistics related to display resolutions for each ssrc.
* {{
Expand Down Expand Up @@ -208,6 +218,27 @@ class ConnectionStatsTable extends Component {
);
}

/**
* Creates a table row as a ReactElement for displaying end-to-end RTT and
* the region.
*
* @returns {ReactElement}
* @private
*/
_renderE2eRtt() {
const { e2eRtt, region, t } = this.props;
const str = `${e2eRtt.toFixed(0)}ms (${region ? region : 'unknown'})`;

return (
<tr>
<td>
<span>{ t('connectionindicator.e2e_rtt') }</span>
</td>
<td>{ str }</td>
</tr>
);
}

/**
* Creates a table row as a ReactElement for displaying frame rate related
* statistics.
Expand Down Expand Up @@ -330,12 +361,15 @@ class ConnectionStatsTable extends Component {
* @returns {ReactElement}
*/
_renderStatistics() {
const isRemoteVideo = !this.props.isLocalVideo;

return (
<table className = 'connection-info__container'>
<tbody>
{ this._renderConnectionSummary() }
{ this._renderBitrate() }
{ this._renderPacketLoss() }
{ isRemoteVideo ? this._renderE2eRtt() : null }
{ this._renderResolution() }
{ this._renderFrameRate() }
</tbody>
Expand Down

0 comments on commit 2ee1bf9

Please sign in to comment.