|
@@ -1,6 +1,10 @@
|
1
|
1
|
/* global __filename */
|
|
2
|
+import isEqual from 'lodash.isequal';
|
2
|
3
|
|
3
|
|
-import { createRtpStatsEvent } from '../../service/statistics/AnalyticsEvents';
|
|
4
|
+import {
|
|
5
|
+ createRtpStatsEvent,
|
|
6
|
+ createTransportStatsEvent
|
|
7
|
+} from '../../service/statistics/AnalyticsEvents';
|
4
|
8
|
import { getLogger } from 'jitsi-meet-logger';
|
5
|
9
|
import * as ConnectionQualityEvents
|
6
|
10
|
from '../../service/connectivity/ConnectionQualityEvents';
|
|
@@ -523,7 +527,12 @@ export default class AvgRTPStatsReporter {
|
523
|
527
|
*/
|
524
|
528
|
this._avgCQ = new AverageStatReport('connection_quality');
|
525
|
529
|
|
526
|
|
- this._onLocalStatsUpdated = data => this._calculateAvgStats(data);
|
|
530
|
+ this._cachedTransportStats = undefined;
|
|
531
|
+
|
|
532
|
+ this._onLocalStatsUpdated = data => {
|
|
533
|
+ this._calculateAvgStats(data);
|
|
534
|
+ this._maybeSendTransportAnalyticsEvent(data);
|
|
535
|
+ };
|
527
|
536
|
conference.on(
|
528
|
537
|
ConnectionQualityEvents.LOCAL_STATS_UPDATED,
|
529
|
538
|
this._onLocalStatsUpdated);
|
|
@@ -920,6 +929,29 @@ export default class AvgRTPStatsReporter {
|
920
|
929
|
return peerFpsSum / peerSsrcCount;
|
921
|
930
|
}
|
922
|
931
|
|
|
932
|
+ /**
|
|
933
|
+ * Sends the 'transport.stats' analytics event whenever we detect that
|
|
934
|
+ * there is a change in the local or remote candidate type on the transport
|
|
935
|
+ * that is currently selected.
|
|
936
|
+ * @param {*} data
|
|
937
|
+ * @private
|
|
938
|
+ */
|
|
939
|
+ _maybeSendTransportAnalyticsEvent(data) {
|
|
940
|
+ if (!data || !data.transport || !data.transport.length) {
|
|
941
|
+ return;
|
|
942
|
+ }
|
|
943
|
+ const transportStats = {
|
|
944
|
+ 'local_candidate_type': data.transport[0].localCandidateType,
|
|
945
|
+ 'remote_candidate_type': data.transport[0].remoteCandidateType,
|
|
946
|
+ 'transport_type': data.transport[0].type
|
|
947
|
+ };
|
|
948
|
+
|
|
949
|
+ if (!this._cachedTransportStats || !isEqual(transportStats, this._cachedTransportStats)) {
|
|
950
|
+ this._cachedTransportStats = transportStats;
|
|
951
|
+ Statistics.sendAnalytics(createTransportStatsEvent(transportStats));
|
|
952
|
+ }
|
|
953
|
+ }
|
|
954
|
+
|
923
|
955
|
/**
|
924
|
956
|
* Resets the stats related to JVB connection. Must not be called when in
|
925
|
957
|
* P2P mode, because then the {@link AverageStatReport} instances are
|