run runOnRead command also with RTMP readers

This commit is contained in:
aler9 2021-09-30 13:12:20 +02:00
parent e62ed283d1
commit c46ae16dc7
1 changed files with 9 additions and 0 deletions

View File

@ -277,6 +277,15 @@ func (c *rtmpConn) runRead(ctx context.Context) error {
Author: c, 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 // disable read deadline
c.conn.NetConn().SetReadDeadline(time.Time{}) c.conn.NetConn().SetReadDeadline(time.Time{})