Skip to content

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

send video type to rtcstats (#11426)

George Politise4b50ba419b4
diff --git a/react/features/rtcstats/RTCStats.js b/react/features/rtcstats/RTCStats.js
index 941bb5de8b..bf34381a99 100644
--- a/react/features/rtcstats/RTCStats.js
+++ b/react/features/rtcstats/RTCStats.js
@@ -105,6 +105,16 @@ class RTCStats {
this.trace && this.trace.statsEntry('e2eRtt', null, e2eRttData);
}
+ /**
+ * Send videoType data, the data will be processed by rtcstats-server and saved in the dump file.
+ *
+ * @param {Object} videoTypeData - The object that holds the videoType data.
+ * @returns {void}
+ */
+ sendVideoTypeData(videoTypeData) {
+ this.trace && this.trace.statsEntry('setVideoType', null, videoTypeData);
+ }
+
/**
* Send face expression data, the data will be processed by rtcstats-server and saved in the dump file.
*
diff --git a/react/features/rtcstats/middleware.js b/react/features/rtcstats/middleware.js
index eb221bb7e0..c83a713507 100644
--- a/react/features/rtcstats/middleware.js
+++ b/react/features/rtcstats/middleware.js
@@ -7,6 +7,7 @@ import { CONFERENCE_UNIQUE_ID_SET, E2E_RTT_CHANGED, getConferenceOptions, getRoo
import { LIB_WILL_INIT } from '../base/lib-jitsi-meet/actionTypes';
import { DOMINANT_SPEAKER_CHANGED, getLocalParticipant } from '../base/participants';
import { MiddlewareRegistry } from '../base/redux';
+import { TRACK_ADDED, TRACK_UPDATED } from '../base/tracks';
import { ADD_FACE_EXPRESSION } from '../face-landmarks/actionTypes';
import RTCStats from './RTCStats';
@@ -52,6 +53,38 @@ MiddlewareRegistry.register(store => next => action => {
}
break;
}
+ case TRACK_ADDED: {
+ if (canSendRtcstatsData(state)) {
+ const jitsiTrack = action?.track?.jitsiTrack;
+ const { ssrc, videoType } = jitsiTrack || { };
+
+ // Remote tracks store their ssrc in the jitsiTrack object. Local tracks don't. See getSsrcByTrack.
+ if (videoType && ssrc && !jitsiTrack.isLocal()) {
+ RTCStats.sendVideoTypeData({
+ ssrc,
+ videoType
+ });
+ }
+ }
+ break;
+ }
+ case TRACK_UPDATED: {
+ if (canSendRtcstatsData(state)) {
+ const { videoType, jitsiTrack } = action?.track || { };
+ const { ssrc } = jitsiTrack || { };
+
+ // if the videoType of the remote track has changed we expect to find it in track.videoType. grep for
+ // trackVideoTypeChanged.
+ if (videoType && ssrc && !jitsiTrack.isLocal()) {
+
+ RTCStats.sendVideoTypeData({
+ ssrc,
+ videoType
+ });
+ }
+ }
+ break;
+ }
case CONFERENCE_UNIQUE_ID_SET: {
if (canSendRtcstatsData(state)) {