From c46ae16dc713849b477ed253c1018e1ca99faf64 Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Thu, 30 Sep 2021 13:12:20 +0200 Subject: [PATCH] run runOnRead command also with RTMP readers --- internal/core/rtmp_conn.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/core/rtmp_conn.go b/internal/core/rtmp_conn.go index aaed6edf..ac5cab02 100644 --- a/internal/core/rtmp_conn.go +++ b/internal/core/rtmp_conn.go @@ -277,6 +277,15 @@ func (c *rtmpConn) runRead(ctx context.Context) error { Author: c, }) + if c.path.Conf().RunOnRead != "" { + _, port, _ := net.SplitHostPort(c.rtspAddress) + onReadCmd := externalcmd.New(c.path.Conf().RunOnRead, c.path.Conf().RunOnReadRestart, externalcmd.Environment{ + Path: c.path.Name(), + Port: port, + }) + defer onReadCmd.Close() + } + // disable read deadline c.conn.NetConn().SetReadDeadline(time.Time{})