Skip to content

Commit

Permalink
fix(audio): restore "add more data to audio_joined/failure logs" (big…
Browse files Browse the repository at this point in the history
…bluebutton#21215)

Commit 26815f4 was seemingly lost
during a merge in the 3.0.x-release branch. Nothing breaks, but we're
missing the log info originally added via that commit.

Restore the changes in 26815f4:
  - Add secondsToActivateAudio, inputDeviceId, outputDeviceId and isListenOnly
to audio_joined.extraInfo
  - Add inputDeviceId, outputDeviceId and isListenOnly to
audio_failure.extraInfo
  - Add a try-catch to the device enforcement procedure triggered by
onAudioJoin - it may throw and block the modal.
  • Loading branch information
prlanzarin authored Sep 20, 2024
1 parent 14c92a3 commit 5760fb5
Showing 1 changed file with 46 additions and 24 deletions.
70 changes: 46 additions & 24 deletions bigbluebutton-html5/imports/ui/services/audio-manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,39 +547,58 @@ class AudioManager {
);
}

try {
this.inputStream = this.bridge ? this.bridge.inputStream : null;
// Enforce correct output device on audio join
this.changeOutputDevice(this.outputDeviceId, true);
storeAudioOutputDeviceId(this.outputDeviceId);
// Extract the deviceId again from the stream to guarantee consistency
// between stream DID vs chosen DID. That's necessary in scenarios where,
// eg, there's no default/pre-set deviceId ('') and the browser's
// default device has been altered by the user (browser default != system's
// default).
if (this.inputStream) {
const extractedDeviceId = MediaStreamUtils.extractDeviceIdFromStream(
this.inputStream,
'audio',
);
if (extractedDeviceId && extractedDeviceId !== this.inputDeviceId) {
this.changeInputDevice(extractedDeviceId);
}
}
// Audio joined successfully - add device IDs to session storage so they
// can be re-used on refreshes/other sessions
storeAudioInputDeviceId(this.inputDeviceId);
} catch (error) {
logger.warn({
logCode: 'audiomanager_device_enforce_failed',
extraInfo: {
errorName: error.name,
errorMessage: error.message,
inputDeviceId: this.inputDeviceId,
outputDeviceId: this.outputDeviceId,
},
}, `Failed to enforce input/output devices: ${error.message}`);
}

if (!this.isEchoTest) {
this.notify(this.intl.formatMessage(this.messages.info.JOINED_AUDIO));
logger.info({ logCode: 'audio_joined' }, 'Audio Joined');
this.inputStream = this.bridge ? this.bridge.inputStream : null;
logger.info({
logCode: 'audio_joined',
extraInfo: {
secondsToActivateAudio,
inputDeviceId: this.inputDeviceId,
outputDeviceId: this.outputDeviceId,
isListenOnly: this.isListenOnly,
},
}, 'Audio Joined');
if (STATS.enabled) this.monitor();
this.audioEventHandler({
name: 'started',
isListenOnly: this.isListenOnly,
});
}
Session.setItem('audioModalIsOpen', false);

// Enforce correct output device on audio join
this.changeOutputDevice(this.outputDeviceId, true);
storeAudioOutputDeviceId(this.outputDeviceId);

// Extract the deviceId again from the stream to guarantee consistency
// between stream DID vs chosen DID. That's necessary in scenarios where,
// eg, there's no default/pre-set deviceId ('') and the browser's
// default device has been altered by the user (browser default != system's
// default).
if (this.inputStream) {
const extractedDeviceId = MediaStreamUtils.extractDeviceIdFromStream(
this.inputStream,
'audio',
);
if (extractedDeviceId && extractedDeviceId !== this.inputDeviceId) {
this.changeInputDevice(extractedDeviceId);
}
}
// Audio joined successfully - add device IDs to session storage so they
// can be re-used on refreshes/other sessions
storeAudioInputDeviceId(this.inputDeviceId);
}

onTransferStart() {
Expand Down Expand Up @@ -654,6 +673,9 @@ class AudioManager {
errorCode: error,
cause: bridgeError,
bridge,
inputDeviceId: this.inputDeviceId,
outputDeviceId: this.outputDeviceId,
isListenOnly: this.isListenOnly,
},
},
`Audio error - errorCode=${error}, cause=${bridgeError}`
Expand Down

0 comments on commit 5760fb5

Please sign in to comment.