From b3b7beddf96847ae3f507e08c253e2bf9dc11698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AE=87=E7=BF=94?= <178529795@qq.com> Date: Mon, 2 Mar 2020 17:35:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E5=B8=83=E7=BB=93?= =?UTF-8?q?=E6=9D=9F=E4=BC=A0=E9=80=92=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 4693277..f35432c 100644 --- a/main.go +++ b/main.go @@ -21,6 +21,7 @@ type TS struct { TSInfo //TsChan chan io.Reader lastDts uint64 + parent Publisher } type TSInfo struct { TotalPesCount int @@ -164,8 +165,15 @@ func (ts *TS) run() { } } } - +func (ts *TS) OnClosed() { + if ts.parent != nil { + ts.parent.OnClosed() + } +} func (ts *TS) Publish(streamPath string, publisher Publisher) (result bool) { + if publisher != ts { + ts.parent = publisher + } if result = ts.InputStream.Publish(streamPath, publisher); result { ts.TSInfo.RoomInfo = &ts.Room.RoomInfo ts.MpegTsStream = mpegts.NewMpegTsStream(2048)