mirror of https://bitbucket.org/ausocean/av.git
Move port defaulting logic to parseURL().
This commit is contained in:
parent
89d9bf3eef
commit
0105c76dc5
11
rtmp/conn.go
11
rtmp/conn.go
|
@ -121,17 +121,6 @@ func Dial(url string, timeout uint, log Log) (*Conn, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if c.link.port == 0 {
|
|
||||||
switch {
|
|
||||||
case (c.link.protocol & featureSSL) != 0:
|
|
||||||
c.link.port = 433
|
|
||||||
c.log(FatalLevel, pkg+"SSL not supported")
|
|
||||||
case (c.link.protocol & featureHTTP) != 0:
|
|
||||||
c.link.port = 80
|
|
||||||
default:
|
|
||||||
c.link.port = 1935
|
|
||||||
}
|
|
||||||
}
|
|
||||||
c.link.url = rtmpProtocolStrings[c.link.protocol] + "://" + c.link.host + ":" + strconv.Itoa(int(c.link.port)) + "/" + c.link.app
|
c.link.url = rtmpProtocolStrings[c.link.protocol] + "://" + c.link.host + ":" + strconv.Itoa(int(c.link.port)) + "/" + c.link.app
|
||||||
c.link.protocol |= featureWrite
|
c.link.protocol |= featureWrite
|
||||||
|
|
||||||
|
|
|
@ -99,5 +99,15 @@ func parseURL(addr string) (protocol int32, host string, port uint16, app, playp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if port == 0 {
|
||||||
|
switch {
|
||||||
|
case (protocol & featureSSL) != 0:
|
||||||
|
port = 433
|
||||||
|
case (protocol & featureHTTP) != 0:
|
||||||
|
port = 80
|
||||||
|
default:
|
||||||
|
port = 1935
|
||||||
|
}
|
||||||
|
}
|
||||||
return protocol, host, port, app, playpath, nil
|
return protocol, host, port, app, playpath, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue