Rewrite FLV/RTMP clients

This commit is contained in:
Alexey Khit
2023-08-16 19:35:13 +03:00
parent 4e1a0e1ab9
commit c3ba8db660
9 changed files with 227 additions and 204 deletions
+7 -3
View File
@@ -5,7 +5,7 @@ import (
"io"
)
const ProbeSize = 5 * 1024 * 1024 // 5MB
const ProbeSize = 1024 * 1024 // 1MB
const (
BufferDisable = 0
@@ -95,7 +95,11 @@ func (r *ReadSeeker) Peek(n int) ([]byte, error) {
if _, err := io.ReadAtLeast(r, b, n); err != nil {
return nil, err
}
r.BufferSize = BufferDrainAndClear
r.pos = 0
r.Rewind()
return b, nil
}
func (r *ReadSeeker) Rewind() {
r.BufferSize = BufferDrainAndClear
r.pos = 0
}