]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Fix flv重复接收到起始段,退出
authorqydysky <32743305+qydysky@users.noreply.github.com>
Tue, 28 Feb 2023 17:49:22 +0000 (01:49 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Tue, 28 Feb 2023 17:49:22 +0000 (01:49 +0800)
Reply/fmp4Decode_test.go
Reply/stream.go

index 363a3f8d26c25cf49bb8d54cf65fdc1d1fd520de..bc634ba3a1c881dfa5d994670bd1fc67a1a7988f 100644 (file)
@@ -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)
                }
index b0e3395c32e2fa554f584c5859c5765187c6f80a..36c637c9399e7f0f85f4c46c46bd7dd5c25b8dde 100644 (file)
@@ -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