mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-05 21:12:49 +08:00
fix(voice): keep both mic-test takes playable
Record the original take from a pre-denoise AudioContext tap instead of the already-captured getUserMedia track, and wait for every MediaRecorder onstop before publishing URLs so a late dry dataavailable is not dropped. Show an explicit missing-take message when a tab has no playable URL, and flush recorders before releasing standalone capture.
This commit is contained in:
1 parent
47abe356f5
commit
5d3af8dfbb
8 files changed
+492
-44
No files matched your search
@@ -29,6 +29,12 @@ class TestTrack extends EventTarget {
|
||||
readyState = "live";
|
||||
stopped = 0;
|
||||
stop() { this.stopped++; this.readyState = "ended"; }
|
||||
clone() {
|
||||
const copy = new TestTrack();
|
||||
copy.kind = this.kind;
|
||||
copy.readyState = this.readyState;
|
||||
return copy;
|
||||
}
|
||||
getSettings() { return { displaySurface: "monitor", width: 1920, height: 1080, frameRate: 60 }; }
|
||||
async applyConstraints() {}
|
||||
}
|
||||
@@ -140,7 +146,18 @@ class AudioContextStub extends EventTarget {
|
||||
function microphoneStream() {
|
||||
const track = new TestTrack();
|
||||
track.kind = "audio";
|
||||
return { track, getTracks: () => [track], getVideoTracks: () => [], getAudioTracks: () => [track] };
|
||||
const stream = {
|
||||
track,
|
||||
getTracks: () => [track],
|
||||
getVideoTracks: () => [],
|
||||
getAudioTracks: () => [track],
|
||||
clone() {
|
||||
const copy = microphoneStream();
|
||||
copy.track.kind = "audio";
|
||||
return copy;
|
||||
},
|
||||
};
|
||||
return stream;
|
||||
}
|
||||
|
||||
function displayStream() {
|
||||
@@ -1340,7 +1357,9 @@ test("failed initial WebRTC input allocation releases partial nodes and restores
|
||||
socket.receive({ type: "connected", tsClientId: 1, webrtcAvailable: true });
|
||||
await nextTurn();
|
||||
assert.equal(TestPeer.instances[0].connectionState, "closed");
|
||||
assert.equal(AudioContextStub.destinations[1].stream.track.readyState, "ended");
|
||||
const destinationStates = AudioContextStub.destinations.map(node => node.stream.track.readyState);
|
||||
assert.ok(destinationStates.includes("ended"), "failed WebRTC mix destination is released");
|
||||
assert.ok(destinationStates.filter(state => state === "live").length >= 2, "dry and processed capture taps stay live for PCM fallback");
|
||||
assert.ok(AudioContextStub.mediaSources[1].disconnects > 0);
|
||||
assert.equal(voice.state.microphoneErrorCode, "");
|
||||
assert.equal(voice.state.audioNoticeCode, "WEBRTC_FAILED");
|
||||
@@ -2403,10 +2422,13 @@ test("stopping a connected microphone test publishes its recording without stopp
|
||||
await nextTurn();
|
||||
await voice.startMicrophoneTest();
|
||||
const recorder = RecorderStub.instances.at(-1);
|
||||
const liveTracks = AudioContextStub.mediaSources.map(node => node.stream.track);
|
||||
assert.ok(liveTracks.length, "expected a live capture graph");
|
||||
voice.stopMicrophoneTest();
|
||||
recorder.finish();
|
||||
assert.equal(voice.testAudioUrl.value, "blob:connected");
|
||||
assert.equal(recorder.stream.track.readyState, "live");
|
||||
assert.equal(voice.testAudioDryUrl.value, "blob:connected");
|
||||
assert.ok(liveTracks.every(track => track.readyState === "live"), "room capture must stay live");
|
||||
assert.equal(voice.state.connected, true);
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user