frameCount = 0
)
defer ticker.Stop()
+ defer t.Stream_msg.PushLock_tag(`close`, nil)
for {
n, e := rc.Read(buf)
_ = buff.Append(buf[:n])
if e != nil {
- t.Stream_msg.PushLock_tag(`close`, nil)
+ r.Cancel()
break
}
t.Stream_msg.PushLock_tag(`data`, t.first_buf)
t.msg.Push_tag(`load`, t)
}
- if len(t.first_buf) != 0 && keyframe.Size() != 0 {
+ if keyframe.Size() != 0 {
+ if len(t.first_buf) == 0 {
+ t.log.L(`W: `, `flv未接收到起始段`)
+ r.Cancel()
+ break
+ }
t.bootBufPush(keyframe.GetPureBuf())
keyframe.Reset()
t.Stream_msg.PushLock_tag(`data`, t.boot_buf)
}
// 发送空字节会导致流服务终止
- t.Stream_msg.PushLock_tag(`data`, []byte{})
+ t.Stream_msg.PushLock_tag(`close`, nil)
return
}