From 321ca75d713f0f87985da2a7dac328aee6000bd4 Mon Sep 17 00:00:00 2001 From: qydysky Date: Fri, 4 Aug 2023 14:09:14 +0800 Subject: [PATCH] =?utf8?q?Add=20=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE=20?= =?utf8?q?=E5=88=86=E6=AE=B5=E6=97=B6=E9=95=BFmin?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/stream.go | 9 +++++++++ demo/config/config_K_v.json | 2 ++ 2 files changed, 11 insertions(+) diff --git a/Reply/stream.go b/Reply/stream.go index 200be3e..5bb6076 100644 --- a/Reply/stream.go +++ b/Reply/stream.go @@ -1206,6 +1206,15 @@ func (t *M4SStream) Start() bool { contextC, cancel := context.WithCancel(mainContextC) fc.FlashWithCallback(cancel) + // 分段时长min + if l, ok := ms.common.K_v.LoadV("分段时长min").(float64); ok && l > 0 { + tc := time.AfterFunc(time.Duration(int64(time.Minute)*int64(l)), func() { + ms.log.Base_add(`分段`).L(`I: `, ms.common.Roomid, "ok") + ms.msg.Push_tag(`cut`, ms) + }) + defer tc.Stop() + } + // 当stopRec时,取消录制 cancelMsg := ms.msg.Pull_tag_only(`stopRec`, func(_ *M4SStream) (disable bool) { cancel() diff --git a/demo/config/config_K_v.json b/demo/config/config_K_v.json index 0790ebe..963eabf 100644 --- a/demo/config/config_K_v.json +++ b/demo/config/config_K_v.json @@ -72,6 +72,8 @@ "flv断流超时s": 5, "flv断流续接": true, "fmp4切片下载超时s": 3, + "分段时长min-help": "=0为不启动功能,>0为指定分钟数时分段", + "分段时长min": 0, "直播流保存位置": "./live", "直播流保存天数-help": "当t日有1录播时,会尝试删除t-n日的1个最早的录播。小于1的数将禁用此功能", "直播流保存天数": 4, -- 2.39.2