1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-12 19:55:59 +01:00

Remove packet pacing.

It's not obvious that it's useful, especially now that the writer
is split into multiple threads.  Do retain the dynamically computed
delay in case of audio congestion.
This commit is contained in:
Juliusz Chroboczek 2020-09-13 09:40:49 +02:00
parent 96dbcd9dcb
commit 1fe64e15f0

View file

@ -17,8 +17,6 @@ type packetIndex struct {
seqno uint16 seqno uint16
// the index in the cache // the index in the cache
index uint16 index uint16
// the expected delay until the next packet, in jiffies
delay uint32
} }
// An rtpWriterPool is a set of rtpWriters // An rtpWriterPool is a set of rtpWriters
@ -109,7 +107,7 @@ func (wp *rtpWriterPool) close() {
// write writes a packet stored in the packet cache to all local tracks // write writes a packet stored in the packet cache to all local tracks
func (wp *rtpWriterPool) write(seqno uint16, index uint16, delay uint32, isvideo bool, marker bool) { func (wp *rtpWriterPool) write(seqno uint16, index uint16, delay uint32, isvideo bool, marker bool) {
pi := packetIndex{seqno, index, delay} pi := packetIndex{seqno, index}
var dead []*rtpWriter var dead []*rtpWriter
for _, w := range wp.writers { for _, w := range wp.writers {
@ -143,11 +141,6 @@ func (wp *rtpWriterPool) write(seqno uint16, index uint16, delay uint32, isvideo
timer := time.NewTimer(rtptime.ToDuration( timer := time.NewTimer(rtptime.ToDuration(
uint64(d), rtptime.JiffiesPerSec, uint64(d), rtptime.JiffiesPerSec,
)) ))
if pi.delay > d {
pi.delay -= d
} else {
pi.delay = 0
}
select { select {
case w.ch <- pi: case w.ch <- pi:
@ -286,14 +279,6 @@ func rtpWriterLoop(writer *rtpWriter, conn *rtpUpConnection, track *rtpUpTrack)
continue continue
} }
var delay time.Duration
if len(local) > 0 {
delay = rtptime.ToDuration(
uint64(pi.delay/uint32(len(local))),
rtptime.JiffiesPerSec,
)
}
kfNeeded := false kfNeeded := false
for _, l := range local { for _, l := range local {
err := l.WriteRTP(&packet) err := l.WriteRTP(&packet)
@ -304,9 +289,6 @@ func rtpWriterLoop(writer *rtpWriter, conn *rtpUpConnection, track *rtpUpTrack)
continue continue
} }
l.Accumulate(uint32(bytes)) l.Accumulate(uint32(bytes))
if delay > 0 {
time.Sleep(delay)
}
} }
if kfNeeded { if kfNeeded {