From bbf58aeec508e00630a111151fcb94f65ae33488 Mon Sep 17 00:00:00 2001 From: qydysky Date: Wed, 2 Aug 2023 00:33:36 +0800 Subject: [PATCH] =?utf8?q?Add=20fmp4=E5=88=87=E7=89=87=E4=B8=8B=E8=BD=BD?= =?utf8?q?=E8=B6=85=E6=97=B6s?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/stream.go | 13 +++++++++---- demo/config/config_K_v.json | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Reply/stream.go b/Reply/stream.go index 90b9dd9..6958cd5 100644 --- a/Reply/stream.go +++ b/Reply/stream.go @@ -712,7 +712,7 @@ func (t *M4SStream) saveStreamFlv() (e error) { readTO int64 = 5 ) leastReadUnix.Store(time.Now().Unix()) - if v, ok := c.C.K_v.LoadV(`flv断流超时s`).(float64); ok && int64(v) > readTO { + if v, ok := t.common.K_v.LoadV(`flv断流超时s`).(float64); ok && int64(v) > readTO { readTO = int64(v) } @@ -854,7 +854,7 @@ func (t *M4SStream) saveStreamFlv() (e error) { } cancel() - if v1, ok := c.C.K_v.LoadV(`flv断流续接`).(bool); ok && !v1 { + if v1, ok := t.common.K_v.LoadV(`flv断流续接`).(bool); ok && !v1 { break } v.DisableAuto() @@ -874,8 +874,13 @@ func (t *M4SStream) saveStreamM4s() (e error) { fmp4Decoder = &Fmp4Decoder{} keyframe = slice.New[byte]() frameCount = 0 + to = 3 ) + if v, ok := t.common.K_v.LoadV(`fmp4切片下载超时s`).(float64); ok && to < int(v) { + to = int(v) + } + // 下载循环 for download_seq := []*m4s_link_item{}; ; { @@ -938,8 +943,8 @@ func (t *M4SStream) saveStreamM4s() (e error) { defer t.reqPool.Put(r) reqConfig := reqf.Rval{ Url: link.Url, - Timeout: 3000, - WriteLoopTO: 5000, + Timeout: to * 1000, + WriteLoopTO: (to + 2) * 1000, Proxy: t.common.Proxy, Header: map[string]string{ `Connection`: `close`, diff --git a/demo/config/config_K_v.json b/demo/config/config_K_v.json index f67b989..689ee93 100644 --- a/demo/config/config_K_v.json +++ b/demo/config/config_K_v.json @@ -71,6 +71,7 @@ "直播流类型": "flv", "flv断流超时s": 7, "flv断流续接": true, + "fmp4切片下载超时s": 3, "直播流保存位置": "./live", "直播流保存天数-help": "当t日有1录播时,会尝试删除t-n日的1个最早的录播。小于1的数将禁用此功能", "直播流保存天数": 4, -- 2.39.2