From 74767205fdba4664be93bd4679e90bbc32d2ee82 Mon Sep 17 00:00:00 2001 From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Wed, 1 Mar 2023 01:49:22 +0800 Subject: [PATCH] =?utf8?q?Fix=20flv=E9=87=8D=E5=A4=8D=E6=8E=A5=E6=94=B6?= =?utf8?q?=E5=88=B0=E8=B5=B7=E5=A7=8B=E6=AE=B5=EF=BC=8C=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/fmp4Decode_test.go | 3 +-- Reply/stream.go | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Reply/fmp4Decode_test.go b/Reply/fmp4Decode_test.go index 363a3f8..bc634ba 100644 --- a/Reply/fmp4Decode_test.go +++ b/Reply/fmp4Decode_test.go @@ -26,7 +26,6 @@ func Test_deal(t *testing.T) { buff := slice.New[byte]() max := 0 fmp4Decoder := new(Fmp4Decoder) - fmp4KeyFrames := slice.New[byte]() for c := 0; true; c++ { n, e := f.Read(buf) @@ -47,7 +46,7 @@ func Test_deal(t *testing.T) { if e != nil { t.Fatal(e) } - last_available_offset, e := fmp4Decoder.Search_stream_fmp4(buff.GetPureBuf(), fmp4KeyFrames) + last_available_offset, _, e := fmp4Decoder.Search_stream_fmp4(buff.GetPureBuf()) if e != nil && e.Error() != "未初始化traks" { t.Fatal(e) } diff --git a/Reply/stream.go b/Reply/stream.go index b0e3395..36c637c 100644 --- a/Reply/stream.go +++ b/Reply/stream.go @@ -682,6 +682,7 @@ func (t *M4SStream) saveStreamFlv() (e error) { buff = slice.New[byte]() buf = make([]byte, 1<<16) ) + defer ticker.Stop() for { n, e := rc.Read(buf) buff.Append(buf[:n]) @@ -716,6 +717,7 @@ func (t *M4SStream) saveStreamFlv() (e error) { if len(t.first_buf) != 0 { t.log.L(`E: `, `flv重复接收到起始段,退出`) r.Cancel() + s.Done() break } t.first_buf = front_buf -- 2.39.2