Przeglądaj źródła

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 lat temu
rodzic
commit
b9addaed71

+ 1
- 13
conference.js Wyświetl plik

@@ -2274,7 +2274,7 @@ export default {
2274 2274
                 })
2275 2275
                 .then(stream => this.useAudioStream(stream))
2276 2276
                 .then(() => {
2277
-                    logger.log('switched local audio device');
2277
+                    logger.log(`switched local audio device: ${this.localAudio?.getDeviceId()}`);
2278 2278
 
2279 2279
                     this._updateAudioDeviceId();
2280 2280
                 })
@@ -2651,12 +2651,6 @@ export default {
2651 2651
         // audio devices detected or if the local audio stream already exists.
2652 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 2654
         APP.store.dispatch(setAudioAvailable(available));
2661 2655
         APP.API.notifyAudioAvailabilityChanged(available);
2662 2656
     },
@@ -2677,12 +2671,6 @@ export default {
2677 2671
         // config).
2678 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 2674
         APP.store.dispatch(setVideoAvailable(available));
2687 2675
         APP.API.notifyVideoAvailabilityChanged(available);
2688 2676
     },

+ 5
- 0
react/features/base/devices/functions.js Wyświetl plik

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

+ 33
- 5
react/features/base/devices/reducer.js Wyświetl plik

@@ -9,6 +9,8 @@ import { groupDevicesByKind } from './functions';
9 9
 
10 10
 import { ReducerRegistry } from '../redux';
11 11
 
12
+import logger from './logger';
13
+
12 14
 const DEFAULT_STATE = {
13 15
     availableDevices: {
14 16
         audioInput: [],
@@ -18,6 +20,24 @@ const DEFAULT_STATE = {
18 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 42
  * Listen for actions which changes the state of known and used devices.
23 43
  *
@@ -35,6 +55,8 @@ ReducerRegistry.register(
35 55
         case UPDATE_DEVICE_LIST: {
36 56
             const deviceList = groupDevicesByKind(action.devices);
37 57
 
58
+            logDeviceList(deviceList);
59
+
38 60
             return {
39 61
                 ...state,
40 62
                 availableDevices: deviceList
@@ -56,11 +78,17 @@ ReducerRegistry.register(
56 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 92
         default:
65 93
             return state;
66 94
         }

Ładowanie…
Anuluj
Zapisz