return
}
- // 如果被主动关闭,则退出saveStreamFlv,否则继续尝试其他live
- s := signal.Init()
+ CookieM := make(map[string]string)
+ t.common.Cookie.Range(func(k, v interface{}) bool {
+ CookieM[k.(string)] = v.(string)
+ return true
+ })
//开始获取
r := t.reqPool.Get()
+ //检查
+ if e := r.Reqf(reqf.Rval{
+ Url: surl.String(),
+ NoResponse: true,
+ JustResponseCode: true,
+ Proxy: t.common.Proxy,
+ Timeout: 5000,
+ Header: map[string]string{
+ `Host`: surl.Host,
+ `User-Agent`: `Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0`,
+ `Accept`: `*/*`,
+ `Accept-Language`: `zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2`,
+ `Origin`: `https://live.bilibili.com`,
+ `Connection`: `keep-alive`,
+ `Pragma`: `no-cache`,
+ `Cache-Control`: `no-cache`,
+ `Referer`: "https://live.bilibili.com/",
+ `Cookie`: reqf.Map_2_Cookies_String(CookieM),
+ },
+ }); e != nil && reqf.IsTimeout(e) {
+ t.reqPool.Put(r)
+ continue
+ }
+
+ // 如果被主动关闭,则退出saveStreamFlv,否则继续尝试其他live
+ s := signal.Init()
{
go func() {
tsc, tscf := t.Status.WaitC()
buff.Append(buf[:n])
if e != nil {
out.Close()
- t.Stream_msg.Push_tag(`close`, nil)
+ t.Stream_msg.PushLock_tag(`close`, nil)
break
}
leastReadUnix.Store(time.Now().Unix())
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)
+ t.Stream_msg.PushLock_tag(`data`, t.first_buf)
}
if len(t.first_buf) != 0 && keyframe.Size() != 0 {
t.bootBufPush(keyframe.GetPureBuf())
keyframe.Reset()
out.Write(t.boot_buf)
- t.Stream_msg.Push_tag(`data`, t.boot_buf)
+ t.Stream_msg.PushLock_tag(`data`, t.boot_buf)
}
if last_available_offset > 1 {
// fmt.Println("write Sync")
buff.Reset()
}()
- CookieM := make(map[string]string)
- t.common.Cookie.Range(func(k, v interface{}) bool {
- CookieM[k.(string)] = v.(string)
- return true
- })
-
t.log.L(`I: `, `flv下载开始`)
r.Reqf(reqf.Rval{
if !keyframe.IsEmpty() {
t.bootBufPush(keyframe.GetPureBuf())
keyframe.Reset()
- t.Stream_msg.Push_tag(`data`, t.boot_buf)
+ t.Stream_msg.PushLock_tag(`data`, t.boot_buf)
if out != nil {
out.Write(t.boot_buf, true)
out.Sync()
}
// 发送空字节会导致流服务终止
- t.Stream_msg.Push_tag(`data`, []byte{})
+ t.Stream_msg.PushLock_tag(`data`, []byte{})
if !t.config.save_as_mp4 {
// 结束
github.com/qydysky/part v0.24.1/go.mod h1:AQJH+BYeN30eKXjkDqGEtw0vx3wVGplBeOMLSyleEDo=
github.com/qydysky/part v0.24.3 h1:bRnN+iYydDyYQHjHX+uVQzdSbglmVwwDUz2QSexO/DY=
github.com/qydysky/part v0.24.3/go.mod h1:AQJH+BYeN30eKXjkDqGEtw0vx3wVGplBeOMLSyleEDo=
+github.com/qydysky/part v0.24.4 h1:JCA1CyggvUNu/B0xKEjnODaUp6rgEi1hjtJwqOTvnaw=
+github.com/qydysky/part v0.24.4/go.mod h1:AQJH+BYeN30eKXjkDqGEtw0vx3wVGplBeOMLSyleEDo=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=