mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-06-09 22:04:43 +00:00
refactor: calculate sample duration based on batch size
This commit is contained in:
@@ -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++
|
||||
|
||||
|
||||
Reference in New Issue
Block a user