mirror of
https://github.com/jech/galene.git
synced 2024-11-26 02:25:58 +01:00
Increase minimum size of packet cache.
Now that we cache keyframes, it is worth keeping some history even when latency is low.
This commit is contained in:
parent
a50e9c6771
commit
67a821ea75
1 changed files with 13 additions and 5 deletions
|
@ -418,7 +418,7 @@ func newUpConn(c group.Client, id string) (*rtpUpConnection, error) {
|
||||||
track := &rtpUpTrack{
|
track := &rtpUpTrack{
|
||||||
track: remote,
|
track: remote,
|
||||||
label: label,
|
label: label,
|
||||||
cache: packetcache.New(32),
|
cache: packetcache.New(minPacketCache(remote)),
|
||||||
rate: estimator.New(time.Second),
|
rate: estimator.New(time.Second),
|
||||||
jitter: jitter.New(remote.Codec().ClockRate),
|
jitter: jitter.New(remote.Codec().ClockRate),
|
||||||
localCh: make(chan localTrackAction, 2),
|
localCh: make(chan localTrackAction, 2),
|
||||||
|
@ -972,6 +972,13 @@ func handleReport(track *rtpDownTrack, report rtcp.ReceptionReport, jiffies uint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func minPacketCache(track *webrtc.Track) int {
|
||||||
|
if track.Kind() == webrtc.RTPCodecTypeVideo {
|
||||||
|
return 128
|
||||||
|
}
|
||||||
|
return 24
|
||||||
|
}
|
||||||
|
|
||||||
func updateUpTrack(track *rtpUpTrack) {
|
func updateUpTrack(track *rtpUpTrack) {
|
||||||
now := rtptime.Jiffies()
|
now := rtptime.Jiffies()
|
||||||
|
|
||||||
|
@ -993,11 +1000,12 @@ func updateUpTrack(track *rtpUpTrack) {
|
||||||
}
|
}
|
||||||
_, r := track.rate.Estimate()
|
_, r := track.rate.Estimate()
|
||||||
packets := int((uint64(r) * maxrto * 4) / rtptime.JiffiesPerSec)
|
packets := int((uint64(r) * maxrto * 4) / rtptime.JiffiesPerSec)
|
||||||
if packets < 32 {
|
min := minPacketCache(track.track)
|
||||||
packets = 32
|
if packets < min {
|
||||||
|
packets = min
|
||||||
}
|
}
|
||||||
if packets > 256 {
|
if packets > 1024 {
|
||||||
packets = 256
|
packets = 1024
|
||||||
}
|
}
|
||||||
track.cache.ResizeCond(packets)
|
track.cache.ResizeCond(packets)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue