From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Sun, 19 Mar 2023 17:18:39 +0000 (+0800) Subject: Improve flv模式优化 X-Git-Tag: v0.7.3~1 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=0c104f8092a5812cede385a7d329de10d43ad257;p=bili_danmu%2F.git Improve flv模式优化 --- diff --git a/Reply/stream.go b/Reply/stream.go index b462982..7eb57a4 100644 --- a/Reply/stream.go +++ b/Reply/stream.go @@ -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)