Skip to content

Commit 4d8822e

Browse files
author
Datanoise
committed
fix: flush Ogg pages immediately after each Opus packet to ensure data flow to listeners
1 parent 23ef212 commit 4d8822e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

relay/transcode.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ func (tm *TranscoderManager) encodeMP3(ctx context.Context, inst *TranscoderInst
197197
if err != nil {
198198
return
199199
}
200+
// Note: Shine MP3 doesn't have a flush but we should ensure
201+
// our writer is called.
200202
atomic.AddInt64(&inst.FramesProcessed, 1)
201203
}
202204
}
@@ -289,6 +291,7 @@ func (tm *TranscoderManager) encodeOpus(ctx context.Context, inst *TranscoderIns
289291
if err := pw.WritePacket(opusPacket[:en], granulePos, false, false); err != nil {
290292
return
291293
}
294+
pw.Flush()
292295

293296
sentCount++
294297
atomic.AddInt64(&inst.FramesProcessed, 1)

0 commit comments

Comments
 (0)