]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Improve flv模式优化
authorqydysky <32743305+qydysky@users.noreply.github.com>
Sun, 19 Mar 2023 17:18:39 +0000 (01:18 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Sun, 19 Mar 2023 17:18:39 +0000 (01:18 +0800)
Reply/stream.go

index b462982182b20d68243f345295238efadaf29189..7eb57a4db27275ddbf82c7270be63e86fcf9e2f0 100644 (file)
@@ -726,20 +726,14 @@ func (t *M4SStream) saveStreamFlv() (e error) {
                                                        //丢弃所有数据
                                                        buff.Reset()
                                                }
-                                               if len(front_buf) != 0 {
-                                                       if len(t.first_buf) != 0 {
-                                                               t.log.L(`E: `, `flv重复接收到起始段,退出`)
-                                                               r.Cancel()
-                                                               s.Done()
-                                                               break
-                                                       }
+                                               if len(front_buf) != 0 && len(t.first_buf) == 0 {
                                                        t.first_buf = make([]byte, len(front_buf))
                                                        copy(t.first_buf, front_buf)
                                                        // fmt.Println("write front_buf")
                                                        out.Write(t.first_buf)
                                                        t.Stream_msg.Push_tag(`data`, t.first_buf)
                                                }
-                                               if keyframe.Size() != 0 {
+                                               if len(t.first_buf) != 0 && keyframe.Size() != 0 {
                                                        t.bootBufPush(keyframe.GetPureBuf())
                                                        keyframe.Reset()
                                                        out.Write(t.boot_buf)