]> 127.0.0.1 Git - part/.git/commitdiff
fix v0.10.5
authorqydysky <32743305+qydysky@users.noreply.github.com>
Sat, 15 Oct 2022 20:30:59 +0000 (04:30 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Sat, 15 Oct 2022 20:30:59 +0000 (04:30 +0800)
websocket/Recoder.go

index 9779916e28754e53635079e0f6ad42f0e9206708..ad50c2dab2c4d2c447418c6063c5b67bf0db1b0e 100644 (file)
@@ -100,13 +100,13 @@ func Play(filePath string, perReadSize int, maxReadSize int) (s *Server, close f
                                if data, err := f.ReadUntil('\n', perReadSize, maxReadSize); err != nil {
                                        panic(err)
                                } else if len(data) != 0 {
-                                       datas := bytes.Split(data, []byte(","))
-                                       d, _ := strconv.ParseFloat(string(datas[0]), 64)
+                                       tIndex := bytes.Index(data, []byte{','})
+                                       danmuIndex := tIndex + bytes.Index(data[tIndex+2:], []byte{','}) + 3
                                        s.Interface().Push_tag(`send`, Uinterface{
                                                Id:   0, //send to all
-                                               Data: datas[2],
+                                               Data: data[danmuIndex:],
                                        })
-                                       if d > cu {
+                                       if d, _ := strconv.ParseFloat(string(data[:tIndex]), 64); d > cu {
                                                break
                                        }
                                } else {