Fix order of muteStateChange update

This commit is contained in:
Fedor Indutny
2025-11-04 14:01:26 -08:00
committed by GitHub
parent fe3a453cc7
commit 7bf1944ad3

View File

@@ -622,8 +622,6 @@ export class CallingClass {
}); });
log.info(logId); log.info(logId);
muteStateChange.setIsMuted(!hasLocalAudio);
const callMode = getConversationCallMode(conversation); const callMode = getConversationCallMode(conversation);
switch (callMode) { switch (callMode) {
case null: case null:
@@ -679,6 +677,7 @@ export class CallingClass {
log.info(`${logId}: Starting lobby`); log.info(`${logId}: Starting lobby`);
await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo }); await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo });
muteStateChange.setIsMuted(!hasLocalAudio);
// It's important that this function comes before any calls to // It's important that this function comes before any calls to
// `videoCapturer.enableCapture` or `videoCapturer.enableCaptureAndSend` because of // `videoCapturer.enableCapture` or `videoCapturer.enableCaptureAndSend` because of
@@ -1035,7 +1034,6 @@ export class CallingClass {
const logId = `startCallLinkLobby(roomId=${roomId})`; const logId = `startCallLinkLobby(roomId=${roomId})`;
log.info(`${logId}: starting`); log.info(`${logId}: starting`);
muteStateChange.setIsMuted(!hasLocalAudio);
const hasLocalVideo = preferLocalVideo && (await checkCameraPermission()); const hasLocalVideo = preferLocalVideo && (await checkCameraPermission());
const haveMediaPermissions = await this.#requestPermissions(hasLocalVideo); const haveMediaPermissions = await this.#requestPermissions(hasLocalVideo);
@@ -1046,8 +1044,8 @@ export class CallingClass {
} }
await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo }); await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo });
await this.#startDeviceReselectionTimer(); await this.#startDeviceReselectionTimer();
muteStateChange.setIsMuted(!hasLocalAudio);
const authCredentialPresentation = const authCredentialPresentation =
await getCallLinkAuthCredentialPresentation(callLinkRootKey); await getCallLinkAuthCredentialPresentation(callLinkRootKey);
@@ -1095,8 +1093,6 @@ export class CallingClass {
const logId = getLogId({ source: 'startOutgoingDirectCall', conversation }); const logId = getLogId({ source: 'startOutgoingDirectCall', conversation });
log.info(logId); log.info(logId);
muteStateChange.setIsMuted(!hasLocalAudio);
if (!this.#reduxInterface) { if (!this.#reduxInterface) {
throw new Error(`${logId}: Redux actions not available`); throw new Error(`${logId}: Redux actions not available`);
} }
@@ -1126,6 +1122,8 @@ export class CallingClass {
return; return;
} }
muteStateChange.setIsMuted(!hasLocalAudio);
log.info(`${logId}: Getting call settings`); log.info(`${logId}: Getting call settings`);
// Check state after awaiting to debounce call button. // Check state after awaiting to debounce call button.
if (RingRTC.call && RingRTC.call.state !== CallState.Ended) { if (RingRTC.call && RingRTC.call.state !== CallState.Ended) {
@@ -1493,6 +1491,7 @@ export class CallingClass {
await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo }); await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo });
await this.#startDeviceReselectionTimer(); await this.#startDeviceReselectionTimer();
muteStateChange.setIsMuted(!hasLocalAudio);
const groupCall = this.connectGroupCall(conversationId, { const groupCall = this.connectGroupCall(conversationId, {
groupId, groupId,
@@ -1853,6 +1852,7 @@ export class CallingClass {
await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo }); await ensureSystemPermissions({ hasLocalAudio, hasLocalVideo });
await this.#startDeviceReselectionTimer(); await this.#startDeviceReselectionTimer();
muteStateChange.setIsMuted(!hasLocalAudio);
const callLinkRootKey = CallLinkRootKey.parse(rootKey); const callLinkRootKey = CallLinkRootKey.parse(rootKey);
const callLinkEpoch = epoch ? CallLinkEpoch.parse(epoch) : undefined; const callLinkEpoch = epoch ? CallLinkEpoch.parse(epoch) : undefined;
@@ -2227,6 +2227,7 @@ export class CallingClass {
hasLocalVideo: asVideoCall, hasLocalVideo: asVideoCall,
}); });
await this.#startDeviceReselectionTimer(); await this.#startDeviceReselectionTimer();
muteStateChange.setIsMuted(false);
if (asVideoCall) { if (asVideoCall) {
// Warm up the camera as soon as possible. // Warm up the camera as soon as possible.