From b388f5374f4ef105b39289484e4f317029842eda Mon Sep 17 00:00:00 2001 From: scruzin Date: Fri, 11 Jan 2019 00:06:44 +1030 Subject: [PATCH] Removed superfluous url param from setupURL() and obtain it from the Session object instead. --- rtmp/rtmp.go | 6 +++--- rtmp/rtmp_test.go | 2 +- rtmp/session.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rtmp/rtmp.go b/rtmp/rtmp.go index a481aa84..bacf300a 100644 --- a/rtmp/rtmp.go +++ b/rtmp/rtmp.go @@ -134,8 +134,8 @@ var ( ) // setupURL parses the RTMP URL. -func setupURL(s *Session, addr string) (err error) { - s.link.protocol, s.link.host, s.link.port, s.link.app, s.link.playpath, err = parseURL(addr) +func setupURL(s *Session) (err error) { + s.link.protocol, s.link.host, s.link.port, s.link.app, s.link.playpath, err = parseURL(s.url) if err != nil { return err } @@ -145,7 +145,7 @@ func setupURL(s *Session, addr string) (err error) { s.link.tcUrl = rtmpProtocolStrings[s.link.protocol] + "://" + s.link.host + ":" + strconv.Itoa(int(s.link.port)) + "/" + s.link.app s.link.lFlags |= RTMP_LF_FTCU } else { - s.link.tcUrl = addr + s.link.tcUrl = s.url } } diff --git a/rtmp/rtmp_test.go b/rtmp/rtmp_test.go index 949ebeef..6e07535a 100644 --- a/rtmp/rtmp_test.go +++ b/rtmp/rtmp_test.go @@ -113,7 +113,7 @@ func TestSetupURL(t *testing.T) { if s.url != testBaseURL && s.link.timeout != testTimeout { t.Errorf("NewSession failed") } - err := setupURL(s, s.url) + err := setupURL(s) if err != nil { t.Errorf("setupURL(testBaseURL) failed with error: %v", err) } diff --git a/rtmp/session.go b/rtmp/session.go index e09b3caa..4b2538a5 100644 --- a/rtmp/session.go +++ b/rtmp/session.go @@ -113,7 +113,7 @@ func (s *Session) Open() error { // start does the heavylifting for Open(). func (s *Session) start() error { s.log(DebugLevel, pkg+"Session.start") - err := setupURL(s, s.url) + err := setupURL(s) if err != nil { s.close() return err