refactor: calculate sample duration based on batch size

This commit is contained in:
zarazaex69
2026-04-30 13:51:55 +03:00
parent 86b92d4fc5
commit 4a5b255db6

View File

@@ -183,6 +183,8 @@ func (p *streamTransport) writerLoop() {
ticker := time.NewTicker(p.frameInterval)
defer ticker.Stop()
sampleDuration := p.frameInterval / time.Duration(p.batchSize)
for {
select {
case <-p.closeCh:
@@ -200,7 +202,7 @@ func (p *streamTransport) writerLoop() {
_ = p.track.WriteSample(media.Sample{
Data: sample,
Duration: p.frameInterval,
Duration: sampleDuration,
})
sent++