mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-25 20:41:59 -08:00
improve streamer performance by using static buffers
This commit is contained in:
parent
adb3909f63
commit
eab4efe726
1 changed files with 8 additions and 2 deletions
10
streamer.go
10
streamer.go
|
|
@ -590,9 +590,15 @@ outer:
|
|||
chanConnError := make(chan struct{})
|
||||
go func() {
|
||||
for {
|
||||
frame := &gortsplib.InterleavedFrame{
|
||||
Content: make([]byte, 512*1024),
|
||||
if !s.readCurBuf {
|
||||
frame.Content = s.readBuf1
|
||||
} else {
|
||||
frame.Content = s.readBuf2
|
||||
}
|
||||
|
||||
frame.Content = frame.Content[:cap(frame.Content)]
|
||||
s.readCurBuf = !s.readCurBuf
|
||||
|
||||
err := conn.ReadInterleavedFrame(frame)
|
||||
if err != nil {
|
||||
s.log("ERR: %s", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue