refactor: replace unpublishTrack mute with setMicrophoneEnabled (Phase 1 RNNoise prep)
- syncMic now uses setMicrophoneEnabled(false/true) to mute/unmute the mic track in-place instead of tearing down and re-publishing via unpublishTrack(). This eliminates WebRTC renegotiation on every mute cycle and preserves the Web Audio pipeline for future AudioWorklet injection (RNNoise WASM). - Unify DmCallView mute/deafen with the primary syncMic path — removed direct setMicrophoneEnabled calls, added missing auto-mute/unmute on deafen toggle. - Strip redundant applyConstraints from VoiceControls noise suppression toggle that was hardcoding echoCancellation:true/autoGainControl:true and fighting AudioManager's constraint pipeline.
This commit is contained in:
@@ -56,25 +56,8 @@ export function VoiceControls() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleNoiseSuppression = async () => {
|
||||
const room = getActiveRoom();
|
||||
if (room) {
|
||||
try {
|
||||
const micPub = room.localParticipant.getTrackPublications().find(
|
||||
p => p.source === 'microphone'
|
||||
);
|
||||
const mediaTrack = micPub?.track?.mediaStreamTrack;
|
||||
if (mediaTrack) {
|
||||
await mediaTrack.applyConstraints({
|
||||
noiseSuppression: !noiseSuppression,
|
||||
echoCancellation: true,
|
||||
autoGainControl: true,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[VoiceControls] Failed to toggle noise suppression:', err);
|
||||
}
|
||||
}
|
||||
const handleNoiseSuppression = () => {
|
||||
// Store toggle triggers syncMic → AudioManager re-acquires stream with correct constraints
|
||||
toggleNoiseSuppression();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user