mirror of
https://github.com/jech/galene.git
synced 2024-11-22 08:35:57 +01:00
Discard old keyframes.
Avoids seqno wraparound. Unlikely, but I'm supersticious.
This commit is contained in:
parent
0eb1593bb8
commit
86f7594626
1 changed files with 8 additions and 0 deletions
|
@ -137,6 +137,10 @@ func (frame *frame) store(seqno uint16, timestamp uint32, first bool, data []byt
|
|||
}
|
||||
} else if len(frame.entries) > 0 {
|
||||
if frame.timestamp != timestamp {
|
||||
delta := seqno - frame.entries[0].seqno
|
||||
if (delta & 0x8000) == 0 && delta > 0x4000 {
|
||||
frame.entries = frame.entries[:0]
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
|
@ -271,6 +275,10 @@ func (cache *Cache) Keyframe() (uint32, []uint16) {
|
|||
cache.mu.Lock()
|
||||
defer cache.mu.Unlock()
|
||||
|
||||
if len(cache.keyframe.entries) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
seqnos := make([]uint16, len(cache.keyframe.entries))
|
||||
for i := range cache.keyframe.entries {
|
||||
seqnos[i] = cache.keyframe.entries[i].seqno
|
||||
|
|
Loading…
Reference in a new issue