]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Improve 精简
authorqydysky <qydysky@foxmail.com>
Sun, 10 Mar 2024 10:28:01 +0000 (18:28 +0800)
committerqydysky <qydysky@foxmail.com>
Sun, 10 Mar 2024 10:28:01 +0000 (18:28 +0800)
Reply/stream.go

index 8da56ac5922483e518d3621c0e69fc551254fbb0..dc284d1556a2b83dbcb51b7d84f57ea0a687e2b5 100644 (file)
@@ -1467,10 +1467,8 @@ func (t *M4SStream) PusherToHttp(conn net.Conn, w http.ResponseWriter, r *http.R
 func (t *M4SStream) bootBufPush(buf []byte) {
        t.boot_buf_locker.Lock()
        defer t.boot_buf_locker.Unlock()
-       if len(t.boot_buf) < len(buf) {
-               t.boot_buf = append(t.boot_buf, make([]byte, len(buf)-len(t.boot_buf))...)
-       }
-       t.boot_buf = t.boot_buf[:copy(t.boot_buf, buf)]
+       t.boot_buf = t.boot_buf[:0]
+       t.boot_buf = append(t.boot_buf, buf...)
 }
 
 func (t *M4SStream) bootBufRead(r func(data []byte) error) error {