From 0c104f8092a5812cede385a7d329de10d43ad257 Mon Sep 17 00:00:00 2001 From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Mon, 20 Mar 2023 01:18:39 +0800 Subject: [PATCH] =?utf8?q?Improve=20flv=E6=A8=A1=E5=BC=8F=E4=BC=98?= =?utf8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/stream.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) 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) -- 2.39.2