mirror of
https://github.com/lkmio/lkm.git
synced 2025-10-05 07:06:57 +08:00
完善rtmp server
This commit is contained in:
@@ -14,6 +14,8 @@ type RingBuffer interface {
|
||||
Tail() interface{}
|
||||
|
||||
Size() int
|
||||
|
||||
All() ([]interface{}, []interface{})
|
||||
}
|
||||
|
||||
func NewRingBuffer(capacity int) RingBuffer {
|
||||
@@ -75,3 +77,11 @@ func (r *ringBuffer) Tail() interface{} {
|
||||
func (r *ringBuffer) Size() int {
|
||||
return r.size
|
||||
}
|
||||
|
||||
func (r *ringBuffer) All() ([]interface{}, []interface{}) {
|
||||
if r.head < r.tail {
|
||||
return r.data[r.head:r.tail], nil
|
||||
} else {
|
||||
return r.data[r.head:], r.data[:r.tail]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user