Documentation ¶
Overview ¶
Package packetcache implement a packet cache that maintains a history of recently seen packets, the last keyframe, and a number of statistics that are needed for sending receiver reports.
Index ¶
- Constants
- func ToBitmap(seqnos []uint16) (first uint16, bitmap uint16, remain []uint16)
- type Cache
- func (cache *Cache) BitmapGet(next uint16) (bool, uint16, uint16)
- func (cache *Cache) Expect(n int)
- func (cache *Cache) Get(seqno uint16, result []byte) uint16
- func (cache *Cache) GetAt(seqno uint16, index uint16, result []byte) uint16
- func (cache *Cache) GetStats(reset bool) Stats
- func (cache *Cache) Keyframe() (uint16, bool)
- func (cache *Cache) Last() (uint16, bool)
- func (cache *Cache) Resize(capacity int)
- func (cache *Cache) ResizeCond(capacity int) bool
- func (cache *Cache) Store(seqno uint16, timestamp uint32, keyframe bool, marker bool, buf []byte) (uint16, uint16)
- type Stats
Constants ¶
const BufSize = 1504
The maximum size of packets stored in the cache. Chosen to be a multiple of 8.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) BitmapGet ¶
BitmapGet shifts up to 17 bits out of the bitmap. It returns a boolean indicating if any were 0, the index of the first 0 bit, and a bitmap indicating any 0 bits after the first one.
func (*Cache) Get ¶
Get retrieves a packet from the cache, returns the number of bytes copied. If result is of length 0, returns the size of the packet.
func (*Cache) GetStats ¶
GetStats returns statistics about received packets. If reset is true, the statistics are reset.
func (*Cache) Resize ¶
Resize resizes the cache to the given capacity. This might invalidate indices of recently stored packets.
func (*Cache) ResizeCond ¶
ResizeCond is like Resize, but avoids invalidating recent indices.