mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
client: reorder parameters
This commit is contained in:
26
client.go
26
client.go
@@ -38,7 +38,15 @@ func DialPublish(address string, tracks Tracks) (*ClientConn, error) {
|
|||||||
// Client is a RTSP client.
|
// Client is a RTSP client.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
//
|
//
|
||||||
// connection
|
// callbacks
|
||||||
|
//
|
||||||
|
// callback called before every request.
|
||||||
|
OnRequest func(*base.Request)
|
||||||
|
// callback called after every response.
|
||||||
|
OnResponse func(*base.Response)
|
||||||
|
|
||||||
|
//
|
||||||
|
// RTSP parameters
|
||||||
//
|
//
|
||||||
// timeout of read operations.
|
// timeout of read operations.
|
||||||
// It defaults to 10 seconds.
|
// It defaults to 10 seconds.
|
||||||
@@ -49,10 +57,6 @@ type Client struct {
|
|||||||
// a TLS configuration to connect to TLS (RTSPS) servers.
|
// a TLS configuration to connect to TLS (RTSPS) servers.
|
||||||
// It defaults to &tls.Config{InsecureSkipVerify:true}
|
// It defaults to &tls.Config{InsecureSkipVerify:true}
|
||||||
TLSConfig *tls.Config
|
TLSConfig *tls.Config
|
||||||
|
|
||||||
//
|
|
||||||
// initialization
|
|
||||||
//
|
|
||||||
// disable being redirected to other servers, that can happen during Describe().
|
// disable being redirected to other servers, that can happen during Describe().
|
||||||
// It defaults to false.
|
// It defaults to false.
|
||||||
RedirectDisable bool
|
RedirectDisable bool
|
||||||
@@ -60,10 +64,6 @@ type Client struct {
|
|||||||
// this can be a security issue.
|
// this can be a security issue.
|
||||||
// It defaults to false.
|
// It defaults to false.
|
||||||
AnyPortEnable bool
|
AnyPortEnable bool
|
||||||
|
|
||||||
//
|
|
||||||
// reading / writing
|
|
||||||
//
|
|
||||||
// the stream transport (UDP, Multicast or TCP).
|
// the stream transport (UDP, Multicast or TCP).
|
||||||
// If nil, it is chosen automatically (first UDP, then, if it fails, TCP).
|
// If nil, it is chosen automatically (first UDP, then, if it fails, TCP).
|
||||||
// It defaults to nil.
|
// It defaults to nil.
|
||||||
@@ -82,14 +82,6 @@ type Client struct {
|
|||||||
// It defaults to 2048.
|
// It defaults to 2048.
|
||||||
ReadBufferSize int
|
ReadBufferSize int
|
||||||
|
|
||||||
//
|
|
||||||
// callbacks
|
|
||||||
//
|
|
||||||
// callback called before every request.
|
|
||||||
OnRequest func(req *base.Request)
|
|
||||||
// callback called after every response.
|
|
||||||
OnResponse func(res *base.Response)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// system functions
|
// system functions
|
||||||
//
|
//
|
||||||
|
@@ -167,7 +167,7 @@ type ClientConn struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newClientConn(c *Client, scheme string, host string) (*ClientConn, error) {
|
func newClientConn(c *Client, scheme string, host string) (*ClientConn, error) {
|
||||||
// connection
|
// RTSP parameters
|
||||||
if c.ReadTimeout == 0 {
|
if c.ReadTimeout == 0 {
|
||||||
c.ReadTimeout = 10 * time.Second
|
c.ReadTimeout = 10 * time.Second
|
||||||
}
|
}
|
||||||
@@ -177,12 +177,9 @@ func newClientConn(c *Client, scheme string, host string) (*ClientConn, error) {
|
|||||||
if c.TLSConfig == nil {
|
if c.TLSConfig == nil {
|
||||||
c.TLSConfig = &tls.Config{InsecureSkipVerify: true}
|
c.TLSConfig = &tls.Config{InsecureSkipVerify: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reading / writing
|
|
||||||
if c.InitialUDPReadTimeout == 0 {
|
if c.InitialUDPReadTimeout == 0 {
|
||||||
c.InitialUDPReadTimeout = 3 * time.Second
|
c.InitialUDPReadTimeout = 3 * time.Second
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ReadBufferCount == 0 {
|
if c.ReadBufferCount == 0 {
|
||||||
c.ReadBufferCount = 1
|
c.ReadBufferCount = 1
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user