From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Tue, 28 Feb 2023 17:49:22 +0000 (+0800) Subject: Fix flv重复接收到起始段,退出 X-Git-Tag: v0.7.0~10 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=74767205fdba4664be93bd4679e90bbc32d2ee82;p=bili_danmu%2F.git Fix flv重复接收到起始段,退出 --- 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