From 47656beec84cfb6a2bd555effd2e2e7972ac35a9 Mon Sep 17 00:00:00 2001 From: qydysky <32743305+qydysky@users.noreply.github.com> Date: Thu, 15 Sep 2022 22:27:24 +0800 Subject: [PATCH] =?utf8?q?=E5=BF=AB=E9=80=9F=E5=90=AF=E5=8A=A8=E7=BC=93?= =?utf8?q?=E5=86=B2=20=E5=A4=9A=E7=BA=BF=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/stream.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Reply/stream.go b/Reply/stream.go index e9fd176..115c4c9 100644 --- a/Reply/stream.go +++ b/Reply/stream.go @@ -33,12 +33,13 @@ type M4SStream struct { config M4SStream_Config //配置 stream_last_modified time.Time //流地址更新时间 // stream_expires int64 //流到期时间 - stream_hosts sync.Map //使用的流服务器 - stream_type string //流类型 - Stream_msg *msgq.Msgq //流数据消息 tag:data - first_buf []byte //m4s起始块 or flv起始块 - boot_buf [][]byte //快速启动缓冲 - boot_buf_size int //快速启动缓冲长度 + stream_hosts sync.Map //使用的流服务器 + stream_type string //流类型 + Stream_msg *msgq.Msgq //流数据消息 tag:data + first_buf []byte //m4s起始块 or flv起始块 + boot_buf [][]byte //快速启动缓冲 + boot_buf_size int //快速启动缓冲长度 + boot_buf_locker funcCtrl.BlockFunc last_m4s *m4s_link_item //最后一个切片 common c.Common //通用配置副本 Current_save_path string //明确的直播流保存目录 @@ -902,6 +903,9 @@ func (t *M4SStream) pusherFlv(w http.ResponseWriter, r *http.Request) { func (t *M4SStream) bootBufPush(buf []byte) { if t.boot_buf != nil { + t.boot_buf_locker.Block() + defer t.boot_buf_locker.UnBlock() + if len(t.boot_buf) == t.boot_buf_size { t.boot_buf = t.boot_buf[1:] } -- 2.39.2