Преглед изворни кода

ref(log): logs device list and selected devices

Logs the device list when is updated in the reducer and removes
"button enabled" logging which used to dump the device list, but
in a useless way(Object[Object]).

Makes an attempt to log currently selected device, but because of
multiple possible paths it's impossible to find one reliable spot to log
selected device. One has to rely on device list and the GUM call logged
to figure things out.
master
paweldomas пре 5 година
родитељ
комит
b9addaed71
3 измењених фајлова са 39 додато и 18 уклоњено
  1. 1
    13
      conference.js
  2. 5
    0
      react/features/base/devices/functions.js
  3. 33
    5
      react/features/base/devices/reducer.js

+ 1
- 13
conference.js Прегледај датотеку

2274
                 })
2274
                 })
2275
                 .then(stream => this.useAudioStream(stream))
2275
                 .then(stream => this.useAudioStream(stream))
2276
                 .then(() => {
2276
                 .then(() => {
2277
-                    logger.log('switched local audio device');
2277
+                    logger.log(`switched local audio device: ${this.localAudio?.getDeviceId()}`);
2278
 
2278
 
2279
                     this._updateAudioDeviceId();
2279
                     this._updateAudioDeviceId();
2280
                 })
2280
                 })
2651
         // audio devices detected or if the local audio stream already exists.
2651
         // audio devices detected or if the local audio stream already exists.
2652
         const available = audioDeviceCount > 0 || Boolean(this.localAudio);
2652
         const available = audioDeviceCount > 0 || Boolean(this.localAudio);
2653
 
2653
 
2654
-        logger.debug(
2655
-            `Microphone button enabled: ${available}`,
2656
-            `local audio: ${this.localAudio}`,
2657
-            `audio devices: ${audioMediaDevices}`,
2658
-            `device count: ${audioDeviceCount}`);
2659
-
2660
         APP.store.dispatch(setAudioAvailable(available));
2654
         APP.store.dispatch(setAudioAvailable(available));
2661
         APP.API.notifyAudioAvailabilityChanged(available);
2655
         APP.API.notifyAudioAvailabilityChanged(available);
2662
     },
2656
     },
2677
         // config).
2671
         // config).
2678
         const available = videoDeviceCount > 0 || Boolean(this.localVideo);
2672
         const available = videoDeviceCount > 0 || Boolean(this.localVideo);
2679
 
2673
 
2680
-        logger.debug(
2681
-            `Camera button enabled: ${available}`,
2682
-            `local video: ${this.localVideo}`,
2683
-            `video devices: ${videoMediaDevices}`,
2684
-            `device count: ${videoDeviceCount}`);
2685
-
2686
         APP.store.dispatch(setVideoAvailable(available));
2674
         APP.store.dispatch(setVideoAvailable(available));
2687
         APP.API.notifyVideoAvailabilityChanged(available);
2675
         APP.API.notifyVideoAvailabilityChanged(available);
2688
     },
2676
     },

+ 5
- 0
react/features/base/devices/functions.js Прегледај датотеку

4
 import JitsiMeetJS from '../lib-jitsi-meet';
4
 import JitsiMeetJS from '../lib-jitsi-meet';
5
 import { updateSettings } from '../settings';
5
 import { updateSettings } from '../settings';
6
 
6
 
7
+import logger from './logger';
8
+
7
 declare var APP: Object;
9
 declare var APP: Object;
8
 
10
 
9
 /**
11
 /**
187
         dispatch: Function,
189
         dispatch: Function,
188
         userSelection: boolean = false,
190
         userSelection: boolean = false,
189
         newLabel: ?string): Promise<*> {
191
         newLabel: ?string): Promise<*> {
192
+
193
+    logger.debug(`setAudioOutputDevice: ${String(newLabel)}[${newId}]`);
194
+
190
     return JitsiMeetJS.mediaDevices.setAudioOutputDevice(newId)
195
     return JitsiMeetJS.mediaDevices.setAudioOutputDevice(newId)
191
         .then(() => {
196
         .then(() => {
192
             const newSettings = {
197
             const newSettings = {

+ 33
- 5
react/features/base/devices/reducer.js Прегледај датотеку

9
 
9
 
10
 import { ReducerRegistry } from '../redux';
10
 import { ReducerRegistry } from '../redux';
11
 
11
 
12
+import logger from './logger';
13
+
12
 const DEFAULT_STATE = {
14
 const DEFAULT_STATE = {
13
     availableDevices: {
15
     availableDevices: {
14
         audioInput: [],
16
         audioInput: [],
18
     pendingRequests: []
20
     pendingRequests: []
19
 };
21
 };
20
 
22
 
23
+/**
24
+ * Logs the current device list.
25
+ *
26
+ * @param {Object} deviceList - Whatever is returned by {@link groupDevicesByKind}.
27
+ * @returns {string}
28
+ */
29
+function logDeviceList(deviceList) {
30
+    const devicesToStr = list => list.map(device => `\t\t${device.label}[${device.deviceId}]`).join('\n');
31
+    const audioInputs = devicesToStr(deviceList.audioInput);
32
+    const audioOutputs = devicesToStr(deviceList.audioOutput);
33
+    const videoInputs = devicesToStr(deviceList.videoInput);
34
+
35
+    logger.debug('Device list updated:\n'
36
+        + `audioInput:\n${audioInputs}\n`
37
+        + `audioOutput:\n${audioOutputs}\n`
38
+        + `videoInput:\n${videoInputs}`);
39
+}
40
+
21
 /**
41
 /**
22
  * Listen for actions which changes the state of known and used devices.
42
  * Listen for actions which changes the state of known and used devices.
23
  *
43
  *
35
         case UPDATE_DEVICE_LIST: {
55
         case UPDATE_DEVICE_LIST: {
36
             const deviceList = groupDevicesByKind(action.devices);
56
             const deviceList = groupDevicesByKind(action.devices);
37
 
57
 
58
+            logDeviceList(deviceList);
59
+
38
             return {
60
             return {
39
                 ...state,
61
                 ...state,
40
                 availableDevices: deviceList
62
                 availableDevices: deviceList
56
                 pendingRequests: [ ]
78
                 pendingRequests: [ ]
57
             };
79
             };
58
 
80
 
59
-        // TODO: Changing of current audio and video device id is currently
60
-        // handled outside of react/redux. Fall through to default logic for
61
-        // now.
62
-        case SET_AUDIO_INPUT_DEVICE:
63
-        case SET_VIDEO_INPUT_DEVICE:
81
+        // TODO: Changing of current audio and video device id is currently handled outside of react/redux.
82
+        case SET_AUDIO_INPUT_DEVICE: {
83
+            logger.debug(`set audio input device: ${action.deviceId}`);
84
+
85
+            return state;
86
+        }
87
+        case SET_VIDEO_INPUT_DEVICE: {
88
+            logger.debug(`set video input device: ${action.deviceId}`);
89
+
90
+            return state;
91
+        }
64
         default:
92
         default:
65
             return state;
93
             return state;
66
         }
94
         }

Loading…
Откажи
Сачувај