fix: Bug - User automatically leaves voice after short period of time
All checks were successful
Queue Release Build / prepare (push) Successful in 22s
Deploy Web Apps / deploy (push) Successful in 7m32s
Queue Release Build / build-windows (push) Successful in 27m41s
Queue Release Build / build-linux (push) Successful in 44m56s
Queue Release Build / build-android (push) Successful in 18m52s
Queue Release Build / finalize (push) Successful in 21s
All checks were successful
Queue Release Build / prepare (push) Successful in 22s
Deploy Web Apps / deploy (push) Successful in 7m32s
Queue Release Build / build-windows (push) Successful in 27m41s
Queue Release Build / build-linux (push) Successful in 44m56s
Queue Release Build / build-android (push) Successful in 18m52s
Queue Release Build / finalize (push) Successful in 21s
Ignore stale P2P self-disconnect voice-state echoes while this client actively owns voice, refresh noise-reduction input on re-join, and repair dual-signal E2E harness expectations. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
vi
|
||||
} from 'vitest';
|
||||
import { NoiseReductionManager } from './noise-reduction.manager';
|
||||
|
||||
describe('NoiseReductionManager', () => {
|
||||
it('replaces the input stream when noise reduction is already enabled', async () => {
|
||||
const manager = new NoiseReductionManager({
|
||||
info: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
error: vi.fn()
|
||||
} as never);
|
||||
const rawStream = createFakeMediaStream('fresh-track');
|
||||
const replacedStream = createFakeMediaStream('clean-track');
|
||||
|
||||
vi.spyOn(manager, 'replaceInputStream').mockResolvedValue(replacedStream);
|
||||
|
||||
const enabledManager = manager as NoiseReductionManager & {
|
||||
_isEnabled: boolean;
|
||||
destinationNode: { stream: MediaStream };
|
||||
};
|
||||
|
||||
enabledManager._isEnabled = true;
|
||||
enabledManager.destinationNode = { stream: createFakeMediaStream('stale-track') };
|
||||
|
||||
await expect(manager.enable(rawStream)).resolves.toBe(replacedStream);
|
||||
expect(manager.replaceInputStream).toHaveBeenCalledWith(rawStream);
|
||||
});
|
||||
});
|
||||
|
||||
function createFakeMediaStream(trackId: string): MediaStream {
|
||||
return {
|
||||
getAudioTracks: () => [{ id: trackId }],
|
||||
getVideoTracks: () => [],
|
||||
getTracks: () => [{ id: trackId }]
|
||||
} as MediaStream;
|
||||
}
|
||||
@@ -66,8 +66,8 @@ export class NoiseReductionManager {
|
||||
*/
|
||||
async enable(rawStream: MediaStream): Promise<MediaStream> {
|
||||
if (this._isEnabled && this.destinationNode) {
|
||||
this.logger.info('Noise reduction already enabled, returning existing clean stream');
|
||||
return this.destinationNode.stream;
|
||||
this.logger.info('Noise reduction already enabled, replacing input stream');
|
||||
return this.replaceInputStream(rawStream);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user