瀏覽代碼

Add codec reporting (if present in lib-jitsi-meet output) to connection stats (#6054)

* Add codec reporting to the stats window for connections.
This will report the audio/video codecs, if reported by lib-jitsi-meet.
master
Russell Graves 5 年之前
父節點
當前提交
2aa6f7ff4b
沒有連結到貢獻者的電子郵件帳戶。

+ 1
- 0
lang/main.json 查看文件

102
         "bandwidth": "Estimated bandwidth:",
102
         "bandwidth": "Estimated bandwidth:",
103
         "bitrate": "Bitrate:",
103
         "bitrate": "Bitrate:",
104
         "bridgeCount": "Server count: ",
104
         "bridgeCount": "Server count: ",
105
+        "codecs": "Codecs (A/V): ",
105
         "connectedTo": "Connected to:",
106
         "connectedTo": "Connected to:",
106
         "e2e_rtt": "E2E RTT:",
107
         "e2e_rtt": "E2E RTT:",
107
         "framerate": "Frame rate:",
108
         "framerate": "Frame rate:",

+ 2
- 0
react/features/connection-indicator/components/web/ConnectionIndicator.js 查看文件

340
             bandwidth,
340
             bandwidth,
341
             bitrate,
341
             bitrate,
342
             bridgeCount,
342
             bridgeCount,
343
+            codec,
343
             e2eRtt,
344
             e2eRtt,
344
             framerate,
345
             framerate,
345
             maxEnabledResolution,
346
             maxEnabledResolution,
355
                 bandwidth = { bandwidth }
356
                 bandwidth = { bandwidth }
356
                 bitrate = { bitrate }
357
                 bitrate = { bitrate }
357
                 bridgeCount = { bridgeCount }
358
                 bridgeCount = { bridgeCount }
359
+                codec = { codec }
358
                 connectionSummary = { this._getConnectionStatusTip() }
360
                 connectionSummary = { this._getConnectionStatusTip() }
359
                 e2eRtt = { e2eRtt }
361
                 e2eRtt = { e2eRtt }
360
                 framerate = { framerate }
362
                 framerate = { framerate }

+ 11
- 2
react/features/connection-indicator/statsEmitter.js 查看文件

122
     _onStatsUpdated(localUserId: string, stats: Object) {
122
     _onStatsUpdated(localUserId: string, stats: Object) {
123
         const allUserFramerates = stats.framerate || {};
123
         const allUserFramerates = stats.framerate || {};
124
         const allUserResolutions = stats.resolution || {};
124
         const allUserResolutions = stats.resolution || {};
125
+        const allUserCodecs = stats.codec || {};
125
 
126
 
126
         // FIXME resolution and framerate are maps keyed off of user ids with
127
         // FIXME resolution and framerate are maps keyed off of user ids with
127
         // stat values. Receivers of stats expect resolution and framerate to
128
         // stat values. Receivers of stats expect resolution and framerate to
129
         // stats objects.
130
         // stats objects.
130
         const modifiedLocalStats = Object.assign({}, stats, {
131
         const modifiedLocalStats = Object.assign({}, stats, {
131
             framerate: allUserFramerates[localUserId],
132
             framerate: allUserFramerates[localUserId],
132
-            resolution: allUserResolutions[localUserId]
133
+            resolution: allUserResolutions[localUserId],
134
+            codec: allUserCodecs[localUserId]
133
         });
135
         });
134
 
136
 
135
         this._emitStatsUpdate(localUserId, modifiedLocalStats);
137
         this._emitStatsUpdate(localUserId, modifiedLocalStats);
138
         // and update remote user stats as needed.
140
         // and update remote user stats as needed.
139
         const framerateUserIds = Object.keys(allUserFramerates);
141
         const framerateUserIds = Object.keys(allUserFramerates);
140
         const resolutionUserIds = Object.keys(allUserResolutions);
142
         const resolutionUserIds = Object.keys(allUserResolutions);
143
+        const codecUserIds = Object.keys(allUserCodecs);
141
 
144
 
142
-        _.union(framerateUserIds, resolutionUserIds)
145
+        _.union(framerateUserIds, resolutionUserIds, codecUserIds)
143
             .filter(id => id !== localUserId)
146
             .filter(id => id !== localUserId)
144
             .forEach(id => {
147
             .forEach(id => {
145
                 const remoteUserStats = {};
148
                 const remoteUserStats = {};
156
                     remoteUserStats.resolution = resolution;
159
                     remoteUserStats.resolution = resolution;
157
                 }
160
                 }
158
 
161
 
162
+                const codec = allUserCodecs[id];
163
+
164
+                if (codec) {
165
+                    remoteUserStats.codec = codec;
166
+                }
167
+
159
                 this._emitStatsUpdate(id, remoteUserStats);
168
                 this._emitStatsUpdate(id, remoteUserStats);
160
             });
169
             });
161
     }
170
     }

+ 45
- 0
react/features/connection-stats/components/ConnectionStatsTable.js 查看文件

34
      */
34
      */
35
     bridgeCount: number,
35
     bridgeCount: number,
36
 
36
 
37
+    /**
38
+     * Audio/video codecs in use for the connection.
39
+     */
40
+    codec: Object,
41
+
37
     /**
42
     /**
38
      * A message describing the connection quality.
43
      * A message describing the connection quality.
39
      */
44
      */
219
         );
224
         );
220
     }
225
     }
221
 
226
 
227
+    /**
228
+     * Creates a a table row as a ReactElement for displaying codec, if present.
229
+     * This will typically be something like "Codecs (A/V): opus, vp8".
230
+     *
231
+     * @private
232
+     * @returns {ReactElement}
233
+     */
234
+    _renderCodecs() {
235
+        const { codec, t } = this.props;
236
+
237
+        if (!codec) {
238
+            return;
239
+        }
240
+
241
+        let codecString;
242
+
243
+        // Only report one codec, in case there are multiple for a user.
244
+        Object.keys(codec || {})
245
+            .forEach(ssrc => {
246
+                const { audio, video } = codec[ssrc];
247
+
248
+                codecString = `${audio}, ${video}`;
249
+            });
250
+
251
+        if (!codecString) {
252
+            codecString = 'N/A';
253
+        }
254
+
255
+        return (
256
+            <tr>
257
+                <td>
258
+                    <span>{ t('connectionindicator.codecs') }</span>
259
+                </td>
260
+                <td>{ codecString }</td>
261
+            </tr>
262
+        );
263
+    }
264
+
265
+
222
     /**
266
     /**
223
      * Creates a table row as a ReactElement for displaying a summary message
267
      * Creates a table row as a ReactElement for displaying a summary message
224
      * about the current connection status.
268
      * about the current connection status.
452
                     { isRemoteVideo ? this._renderRegion() : null }
496
                     { isRemoteVideo ? this._renderRegion() : null }
453
                     { this._renderResolution() }
497
                     { this._renderResolution() }
454
                     { this._renderFrameRate() }
498
                     { this._renderFrameRate() }
499
+                    { this._renderCodecs() }
455
                     { isRemoteVideo ? null : this._renderBridgeCount() }
500
                     { isRemoteVideo ? null : this._renderBridgeCount() }
456
                 </tbody>
501
                 </tbody>
457
             </table>
502
             </table>

Loading…
取消
儲存