完善rtmp server

This commit is contained in:
DESKTOP-COJOJSE\lenovo
2023-11-25 17:45:19 +08:00
parent 33ec8159f1
commit f932284313
14 changed files with 643 additions and 153 deletions

View File

@@ -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]
}
}