mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
fix(voice): mark stream as ended (#10455)
* fix: mark stream as ended refactor: prefer destroying the stream * refactor: callback for nextTick test: wait duration ms to check end chore: eslint test: end before timeout --------- Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { Buffer } from 'node:buffer';
|
||||
import { nextTick } from 'node:process';
|
||||
import { Readable, type ReadableOptions } from 'node:stream';
|
||||
import { SILENCE_FRAME } from '../audio/AudioPlayer';
|
||||
|
||||
@@ -74,6 +75,11 @@ export class AudioReceiveStream extends Readable {
|
||||
this.renewEndTimeout(this.end);
|
||||
}
|
||||
|
||||
if (buffer === null) {
|
||||
// null marks EOF for stream
|
||||
nextTick(() => this.destroy());
|
||||
}
|
||||
|
||||
return super.push(buffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user