From 36c6d0b7ef12497a9358d08583e362bb5b2c8cfc Mon Sep 17 00:00:00 2001 From: aler9 <46489434+aler9@users.noreply.github.com> Date: Sat, 9 Jul 2022 16:53:25 +0200 Subject: [PATCH] client: fix RTSPS default port --- client.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index 5cbeb3e9..5d9f37b2 100644 --- a/client.go +++ b/client.go @@ -977,8 +977,14 @@ func (c *Client) connOpen() error { return fmt.Errorf("RTSPS can be used only with TCP") } - if !strings.Contains(c.host, ":") { - c.host += ":554" + // add default port + _, _, err := net.SplitHostPort(c.host) + if err != nil { + if c.scheme == "rtsp" { + c.host = net.JoinHostPort(c.host, "554") + } else { // rtsps + c.host = net.JoinHostPort(c.host, "8322") + } } ctx, cancel := context.WithTimeout(c.ctx, c.ReadTimeout)