Skip to content

Commit 8777025

Browse files
authored
Wait for dc buffer status low for all published packets (livekit#1691)
1 parent 254b19a commit 8777025

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

.changeset/cuddly-ties-tease.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-client": patch
3+
---
4+
5+
Wait for dc buffer status low for all published packets

src/room/RTCEngine.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,6 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
12511251
}),
12521252
},
12531253
});
1254-
12551254
await this.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
12561255
}
12571256

@@ -1282,6 +1281,8 @@ export default class RTCEngine extends (EventEmitter as new () => TypedEventEmit
12821281

12831282
const msg = packet.toBinary();
12841283

1284+
await this.waitForBufferStatusLow(kind);
1285+
12851286
const dc = this.dataChannelForKind(kind);
12861287
if (dc) {
12871288
if (kind === DataPacket_Kind.RELIABLE) {

src/room/data-stream/outgoing/OutgoingDataStreamManager.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ export default class OutgoingDataStreamManager {
146146
// Implement the sink
147147
async write(text) {
148148
for (const textByteChunk of splitUtf8(text, STREAM_CHUNK_SIZE)) {
149-
await engine.waitForBufferStatusLow(DataPacket_Kind.RELIABLE);
150149
const chunk = new DataStream_Chunk({
151150
content: textByteChunk,
152151
streamId,
@@ -278,7 +277,6 @@ export default class OutgoingDataStreamManager {
278277
try {
279278
while (byteOffset < chunk.byteLength) {
280279
const subChunk = chunk.slice(byteOffset, byteOffset + STREAM_CHUNK_SIZE);
281-
await engine.waitForBufferStatusLow(DataPacket_Kind.RELIABLE);
282280
const chunkPacket = new DataPacket({
283281
destinationIdentities,
284282
value: {

0 commit comments

Comments
 (0)