Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(rtcstats): send facial expressions to rtcstats-server (#10461)

Andrei Gavrilescu0fc381fc6fc9
diff --git a/react/features/rtcstats/RTCStats.js b/react/features/rtcstats/RTCStats.js
index 524c1f5a15..65abaef56c 100644
--- a/react/features/rtcstats/RTCStats.js
+++ b/react/features/rtcstats/RTCStats.js
@@ -95,6 +95,16 @@ class RTCStats {
this.trace && this.trace.statsEntry('dominantSpeaker', null, dominantSpeakerData);
}
+ /**
+ * Send facial expression data, the data will be processed by rtcstats-server and saved in the dump file.
+ *
+ * @param {Object} facialExpressionData - Facial expression data to be saved in the rtcstats dump.
+ * @returns {void}
+ */
+ sendFacialExpressionData(facialExpressionData) {
+ this.trace && this.trace.statsEntry('facialExpression', null, facialExpressionData);
+ }
+
/**
* Connect to the rtcstats server instance. Stats (data obtained from getstats) won't be send until the
* connect successfully initializes, however calls to GUM are recorded in an internal buffer even if not
diff --git a/react/features/rtcstats/middleware.js b/react/features/rtcstats/middleware.js
index 07046f653c..63e0e9ced6 100644
--- a/react/features/rtcstats/middleware.js
+++ b/react/features/rtcstats/middleware.js
@@ -7,6 +7,7 @@ import { CONFERENCE_UNIQUE_ID_SET, getConferenceOptions, getRoomName } from '../
import { LIB_WILL_INIT } from '../base/lib-jitsi-meet';
import { DOMINANT_SPEAKER_CHANGED, getLocalParticipant } from '../base/participants';
import { MiddlewareRegistry } from '../base/redux';
+import { ADD_FACIAL_EXPRESSION } from '../facial-recognition/actionTypes';
import RTCStats from './RTCStats';
import { canSendRtcstatsData, isRtcstatsEnabled } from './functions';
@@ -104,6 +105,17 @@ MiddlewareRegistry.register(store => next => action => {
}
break;
}
+ case ADD_FACIAL_EXPRESSION: {
+ if (canSendRtcstatsData(state)) {
+ const { duration, facialExpression } = action;
+
+ RTCStats.sendFacialExpressionData({
+ duration,
+ facialExpression
+ });
+ }
+ break;
+ }
}
return next(action);