Selaa lähdekoodia

ref(face-expressions) refactor face landmarks namings (#1977)

dev1
Avram Tudor 3 vuotta sitten
vanhempi
commit
832d7d35fa
No account linked to committer's email address

+ 5
- 3
JitsiConference.js Näytä tiedosto

@@ -3749,11 +3749,13 @@ JitsiConference.prototype.getSpeakerStats = function() {
3749 3749
 };
3750 3750
 
3751 3751
 /**
3752
- * Sends a facial expression with its duration to the xmpp server.
3752
+ * Sends a face landmarks object to the xmpp server.
3753 3753
  * @param {Object} payload
3754 3754
  */
3755
-JitsiConference.prototype.sendFacialExpression = function(payload) {
3756
-    this.xmpp.sendFacialExpressionEvent(this.room.roomjid, payload);
3755
+JitsiConference.prototype.sendFaceLandmarks = function(payload) {
3756
+    if (payload.faceExpression) {
3757
+        this.xmpp.sendFaceExpressionEvent(this.room.roomjid, payload);
3758
+    }
3757 3759
 };
3758 3760
 
3759 3761
 /**

+ 3
- 3
JitsiConferenceEvents.spec.ts Näytä tiedosto

@@ -73,7 +73,7 @@ describe( "/JitsiConferenceEvents members", () => {
73 73
         AV_MODERATION_CHANGED,
74 74
         AV_MODERATION_PARTICIPANT_APPROVED,
75 75
         AV_MODERATION_PARTICIPANT_REJECTED,
76
-        FACIAL_EXPRESSION_ADDED,
76
+        FACE_LANDMARK_ADDED,
77 77
         BREAKOUT_ROOMS_MOVE_TO_ROOM,
78 78
         BREAKOUT_ROOMS_UPDATED,
79 79
         JitsiConferenceEvents,
@@ -150,7 +150,7 @@ describe( "/JitsiConferenceEvents members", () => {
150 150
         expect( AV_MODERATION_CHANGED ).toBe( 'conference.av_moderation.changed' );
151 151
         expect( AV_MODERATION_PARTICIPANT_APPROVED ).toBe( 'conference.av_moderation.participant.approved' );
152 152
         expect( AV_MODERATION_PARTICIPANT_REJECTED ).toBe( 'conference.av_moderation.participant.rejected' );
153
-        expect( FACIAL_EXPRESSION_ADDED ).toBe( 'conference.facial_expression.added' );
153
+        expect( FACE_LANDMARK_ADDED ).toBe( 'conference.face_landmark.added' );
154 154
         expect( BREAKOUT_ROOMS_MOVE_TO_ROOM ).toBe( 'conference.breakout-rooms.move-to-room' );
155 155
         expect( BREAKOUT_ROOMS_UPDATED ).toBe( 'conference.breakout-rooms.updated' );
156 156
 
@@ -225,7 +225,7 @@ describe( "/JitsiConferenceEvents members", () => {
225 225
         expect( JitsiConferenceEvents.AV_MODERATION_CHANGED ).toBe( 'conference.av_moderation.changed' );
226 226
         expect( JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED ).toBe( 'conference.av_moderation.participant.approved' );
227 227
         expect( JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED ).toBe( 'conference.av_moderation.participant.rejected' );
228
-        expect( JitsiConferenceEvents.FACIAL_EXPRESSION_ADDED ).toBe( 'conference.facial_expression.added' );
228
+        expect( JitsiConferenceEvents.FACE_LANDMARK_ADDED ).toBe( 'conference.face_landmark.added' );
229 229
         expect( JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM ).toBe( 'conference.breakout-rooms.move-to-room' );
230 230
         expect( JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED ).toBe( 'conference.breakout-rooms.updated' );
231 231
     } );

+ 3
- 3
JitsiConferenceEvents.ts Näytä tiedosto

@@ -451,9 +451,9 @@ export enum JitsiConferenceEvents {
451 451
     AV_MODERATION_PARTICIPANT_REJECTED = 'conference.av_moderation.participant.rejected',
452 452
 
453 453
     /**
454
-     * A new facial expression is added with its duration for a participant
454
+     * A new face landmark object is added for a participant
455 455
      */
456
-    FACIAL_EXPRESSION_ADDED = 'conference.facial_expression.added',
456
+    FACE_LANDMARK_ADDED = 'conference.face_landmark.added',
457 457
 
458 458
     /**
459 459
      * Event fired when a participant is requested to join a given (breakout) room.
@@ -536,6 +536,6 @@ export const AV_MODERATION_REJECTED = JitsiConferenceEvents.AV_MODERATION_REJECT
536 536
 export const AV_MODERATION_CHANGED = JitsiConferenceEvents.AV_MODERATION_CHANGED;
537 537
 export const AV_MODERATION_PARTICIPANT_APPROVED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED;
538 538
 export const AV_MODERATION_PARTICIPANT_REJECTED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED;
539
-export const FACIAL_EXPRESSION_ADDED = JitsiConferenceEvents.FACIAL_EXPRESSION_ADDED;
539
+export const FACE_LANDMARK_ADDED = JitsiConferenceEvents.FACE_LANDMARK_ADDED;
540 540
 export const BREAKOUT_ROOMS_MOVE_TO_ROOM = JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM;
541 541
 export const BREAKOUT_ROOMS_UPDATED = JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED;

+ 4
- 4
modules/connectivity/ConnectionQuality.js Näytä tiedosto

@@ -20,9 +20,9 @@ const STATS_MESSAGE_TYPE = 'stats';
20 20
 
21 21
 /**
22 22
  * The value to use for the "type" field for messages sent
23
- * over the data channel that contain facial expression.
23
+ * over the data channel that contain a face landmark.
24 24
  */
25
-const FACIAL_EXPRESSION_MESSAGE_TYPE = 'facial_expression';
25
+const FACE_LANDMARK_MESSAGE_TYPE = 'face_landmark';
26 26
 
27 27
 const kSimulcastFormats = [
28 28
     { width: 1920,
@@ -232,9 +232,9 @@ export default class ConnectionQuality {
232 232
         conference.on(
233 233
             ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
234 234
             (participant, payload) => {
235
-                if (payload.type === FACIAL_EXPRESSION_MESSAGE_TYPE) {
235
+                if (payload.type === FACE_LANDMARK_MESSAGE_TYPE) {
236 236
                     this.eventEmitter.emit(
237
-                        ConferenceEvents.FACIAL_EXPRESSION_ADDED,
237
+                        ConferenceEvents.FACE_LANDMARK_ADDED,
238 238
                         participant.getId(),
239 239
                         payload);
240 240
                 }

+ 12
- 12
modules/statistics/SpeakerStats.js Näytä tiedosto

@@ -24,7 +24,7 @@ class SpeakerStats {
24 24
         this.totalDominantSpeakerTime = 0;
25 25
         this._dominantSpeakerStart = 0;
26 26
         this._hasLeft = false;
27
-        this._facialExpressions = {
27
+        this._faceExpressions = {
28 28
             happy: 0,
29 29
             neutral: 0,
30 30
             surprised: 0,
@@ -136,32 +136,32 @@ class SpeakerStats {
136 136
     }
137 137
 
138 138
     /**
139
-     * Gets the facial expressions of the user.
139
+     * Gets the face expressions of the user.
140 140
      *
141 141
      * @returns {Object}
142 142
      */
143
-    getFacialExpressions() {
144
-        return this._facialExpressions;
143
+    getFaceExpressions() {
144
+        return this._faceExpressions;
145 145
     }
146 146
 
147 147
     /**
148
-     * Sets the facial expressions of the user.
148
+     * Sets the face expressions of the user.
149 149
      *
150
-     * @param {Object} facialExpressions - object with facial expressions.
150
+     * @param {Object} faceExpressions - object with face expressions.
151 151
      * @returns {void}
152 152
      */
153
-    setFacialExpressions(facialExpressions) {
154
-        this._facialExpressions = facialExpressions;
153
+    setFaceExpressions(faceExpressions) {
154
+        this._faceExpressions = faceExpressions;
155 155
     }
156 156
 
157 157
     /**
158
-     * Adds a new facial expression to speaker stats.
158
+     * Adds a new face expression to speaker stats.
159 159
      *
160
-     * @param  {string} facialExpression
160
+     * @param  {string} faceExpression
161 161
      * @param {number} duration
162 162
      */
163
-    addFacialExpression(facialExpression, duration) {
164
-        this._facialExpressions[facialExpression] += duration;
163
+    addFaceExpression(faceExpression, duration) {
164
+        this._faceExpressions[faceExpression] += duration;
165 165
     }
166 166
 }
167 167
 

+ 8
- 8
modules/statistics/SpeakerStatsCollector.js Näytä tiedosto

@@ -42,8 +42,8 @@ export default class SpeakerStatsCollector {
42 42
             JitsiConferenceEvents.DISPLAY_NAME_CHANGED,
43 43
             this._onDisplayNameChange.bind(this));
44 44
         conference.addEventListener(
45
-            JitsiConferenceEvents.FACIAL_EXPRESSION_ADDED,
46
-            this._onFacialExpressionAdd.bind(this));
45
+            JitsiConferenceEvents.FACE_LANDMARK_ADDED,
46
+            this._onFaceLandmarkAdd.bind(this));
47 47
         if (conference.xmpp) {
48 48
             conference.xmpp.addListener(
49 49
                 XMPPEvents.SPEAKER_STATS_RECEIVED,
@@ -121,18 +121,18 @@ export default class SpeakerStatsCollector {
121 121
     }
122 122
 
123 123
     /**
124
-     * Adds a new facial expression with its duration of a remote user.
124
+     * Processes a new face landmark object of a remote user.
125 125
      *
126 126
      * @param {string} userId - The user id of the user that left.
127
-     * @param {Object} data - The facial expression with its duration.
127
+     * @param {Object} data - The face landmark object.
128 128
      * @returns {void}
129 129
      * @private
130 130
      */
131
-    _onFacialExpressionAdd(userId, data) {
131
+    _onFaceLandmarkAdd(userId, data) {
132 132
         const savedUser = this.stats.users[userId];
133 133
 
134
-        if (savedUser) {
135
-            savedUser.addFacialExpression(data.facialExpression, data.duration);
134
+        if (savedUser && data.faceExpression) {
135
+            savedUser.addFaceExpression(data.faceExpression, data.duration);
136 136
         }
137 137
     }
138 138
 
@@ -177,7 +177,7 @@ export default class SpeakerStatsCollector {
177 177
             speakerStatsToUpdate.totalDominantSpeakerTime
178 178
                 = newStats[userId].totalDominantSpeakerTime;
179 179
 
180
-            speakerStatsToUpdate.setFacialExpressions(newStats[userId].facialExpressions);
180
+            speakerStatsToUpdate.setFaceExpressions(newStats[userId].faceExpressions);
181 181
         }
182 182
     }
183 183
 }

+ 4
- 4
modules/xmpp/xmpp.js Näytä tiedosto

@@ -915,11 +915,11 @@ export default class XMPP extends Listenable {
915 915
     }
916 916
 
917 917
     /**
918
-     * Sends facial expression to speaker stats component.
918
+     * Sends face expressions to speaker stats component.
919 919
      * @param {String} roomJid - The room jid where the speaker event occurred.
920 920
      * @param {Object} payload - The expression to be sent to the speaker stats.
921 921
      */
922
-    sendFacialExpressionEvent(roomJid, payload) {
922
+    sendFaceExpressionEvent(roomJid, payload) {
923 923
         // no speaker stats component advertised
924 924
         if (!this.speakerStatsComponentAddress || !roomJid) {
925 925
             return;
@@ -927,10 +927,10 @@ export default class XMPP extends Listenable {
927 927
 
928 928
         const msg = $msg({ to: this.speakerStatsComponentAddress });
929 929
 
930
-        msg.c('facialExpression', {
930
+        msg.c('faceExpression', {
931 931
             xmlns: 'http://jitsi.org/jitmeet',
932 932
             room: roomJid,
933
-            expression: payload.facialExpression,
933
+            expression: payload.faceExpression,
934 934
             duration: payload.duration
935 935
         }).up();
936 936
 

+ 2
- 2
types/auto/JitsiConference.d.ts Näytä tiedosto

@@ -986,10 +986,10 @@ declare class JitsiConference {
986 986
      */
987 987
     getSpeakerStats(): object;
988 988
     /**
989
-     * Sends a facial expression with its duration to the xmpp server.
989
+     * Sends a face landmarks object to the xmpp server.
990 990
      * @param {Object} payload
991 991
      */
992
-    sendFacialExpression(payload: any): void;
992
+    sendFaceLandmarks(payload: any): void;
993 993
     /**
994 994
      * Sets the constraints for the video that is requested from the bridge.
995 995
      *

+ 3
- 3
types/auto/JitsiConferenceEvents.d.ts Näytä tiedosto

@@ -381,9 +381,9 @@ export declare enum JitsiConferenceEvents {
381 381
      */
382 382
     AV_MODERATION_PARTICIPANT_REJECTED = "conference.av_moderation.participant.rejected",
383 383
     /**
384
-     * A new facial expression is added with its duration for a participant
384
+     * A new face landmark object is added for a participant
385 385
      */
386
-    FACIAL_EXPRESSION_ADDED = "conference.facial_expression.added",
386
+    FACE_LANDMARK_ADDED = "conference.face_landmark.added",
387 387
     /**
388 388
      * Event fired when a participant is requested to join a given (breakout) room.
389 389
      */
@@ -462,6 +462,6 @@ export declare const AV_MODERATION_REJECTED = JitsiConferenceEvents.AV_MODERATIO
462 462
 export declare const AV_MODERATION_CHANGED = JitsiConferenceEvents.AV_MODERATION_CHANGED;
463 463
 export declare const AV_MODERATION_PARTICIPANT_APPROVED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_APPROVED;
464 464
 export declare const AV_MODERATION_PARTICIPANT_REJECTED = JitsiConferenceEvents.AV_MODERATION_PARTICIPANT_REJECTED;
465
-export declare const FACIAL_EXPRESSION_ADDED = JitsiConferenceEvents.FACIAL_EXPRESSION_ADDED;
465
+export declare const FACE_LANDMARK_ADDED = JitsiConferenceEvents.FACE_LANDMARK_ADDED;
466 466
 export declare const BREAKOUT_ROOMS_MOVE_TO_ROOM = JitsiConferenceEvents.BREAKOUT_ROOMS_MOVE_TO_ROOM;
467 467
 export declare const BREAKOUT_ROOMS_UPDATED = JitsiConferenceEvents.BREAKOUT_ROOMS_UPDATED;

+ 9
- 9
types/auto/modules/statistics/SpeakerStats.d.ts Näytä tiedosto

@@ -23,7 +23,7 @@ declare class SpeakerStats {
23 23
     totalDominantSpeakerTime: number;
24 24
     _dominantSpeakerStart: number;
25 25
     _hasLeft: boolean;
26
-    _facialExpressions: {
26
+    _faceExpressions: {
27 27
         happy: number;
28 28
         neutral: number;
29 29
         surprised: number;
@@ -92,23 +92,23 @@ declare class SpeakerStats {
92 92
      */
93 93
     markAsHasLeft(): void;
94 94
     /**
95
-     * Gets the facial expressions of the user.
95
+     * Gets the face expressions of the user.
96 96
      *
97 97
      * @returns {Object}
98 98
      */
99
-    getFacialExpressions(): any;
99
+    getFaceExpressions(): any;
100 100
     /**
101
-     * Sets the facial expressions of the user.
101
+     * Sets the face expressions of the user.
102 102
      *
103
-     * @param {Object} facialExpressions - object with facial expressions.
103
+     * @param {Object} faceExpressions - object with face expressions.
104 104
      * @returns {void}
105 105
      */
106
-    setFacialExpressions(facialExpressions: any): void;
106
+    setFaceExpressions(faceExpressions: any): void;
107 107
     /**
108
-     * Adds a new facial expression to speaker stats.
108
+     * Adds a new face expression to speaker stats.
109 109
      *
110
-     * @param  {string} facialExpression
110
+     * @param  {string} faceExpression
111 111
      * @param {number} duration
112 112
      */
113
-    addFacialExpression(facialExpression: string, duration: number): void;
113
+    addFaceExpression(faceExpression: string, duration: number): void;
114 114
 }

+ 3
- 3
types/auto/modules/statistics/SpeakerStatsCollector.d.ts Näytä tiedosto

@@ -54,14 +54,14 @@ export default class SpeakerStatsCollector {
54 54
      */
55 55
     private _onDisplayNameChange;
56 56
     /**
57
-     * Adds a new facial expression with its duration of a remote user.
57
+     * Processes a new face landmark object of a remote user.
58 58
      *
59 59
      * @param {string} userId - The user id of the user that left.
60
-     * @param {Object} data - The facial expression with its duration.
60
+     * @param {Object} data - The face landmark object.
61 61
      * @returns {void}
62 62
      * @private
63 63
      */
64
-    private _onFacialExpressionAdd;
64
+    private _onFaceLandmarkAdd;
65 65
     /**
66 66
      * Return a copy of the tracked SpeakerStats models.
67 67
      *

+ 2
- 2
types/auto/modules/xmpp/xmpp.d.ts Näytä tiedosto

@@ -240,11 +240,11 @@ export default class XMPP extends Listenable {
240 240
      */
241 241
     sendDominantSpeakerEvent(roomJid: string): void;
242 242
     /**
243
-     * Sends facial expression to speaker stats component.
243
+     * Sends face expressions to speaker stats component.
244 244
      * @param {String} roomJid - The room jid where the speaker event occurred.
245 245
      * @param {Object} payload - The expression to be sent to the speaker stats.
246 246
      */
247
-    sendFacialExpressionEvent(roomJid: string, payload: any): void;
247
+    sendFaceExpressionEvent(roomJid: string, payload: any): void;
248 248
     /**
249 249
      * Check if the given argument is a valid JSON ENDPOINT_MESSAGE string by
250 250
      * parsing it and checking if it has a field called 'type'.

Loading…
Peruuta
Tallenna