mirror of
https://github.com/aler9/gortsplib
synced 2025-10-07 16:10:59 +08:00
change NewConnClient() signature
This commit is contained in:
@@ -49,7 +49,7 @@ type ConnClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewConnClient allocates a ConnClient. See ConnClientConf for the options.
|
// NewConnClient allocates a ConnClient. See ConnClientConf for the options.
|
||||||
func NewConnClient(conf ConnClientConf) (*ConnClient, error) {
|
func NewConnClient(conf ConnClientConf) *ConnClient {
|
||||||
if conf.ReadTimeout == time.Duration(0) {
|
if conf.ReadTimeout == time.Duration(0) {
|
||||||
conf.ReadTimeout = 5 * time.Second
|
conf.ReadTimeout = 5 * time.Second
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ func NewConnClient(conf ConnClientConf) (*ConnClient, error) {
|
|||||||
conf: conf,
|
conf: conf,
|
||||||
br: bufio.NewReaderSize(conf.Conn, clientReadBufferSize),
|
br: bufio.NewReaderSize(conf.Conn, clientReadBufferSize),
|
||||||
bw: bufio.NewWriterSize(conf.Conn, clientWriteBufferSize),
|
bw: bufio.NewWriterSize(conf.Conn, clientWriteBufferSize),
|
||||||
}, nil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetConn returns the underlying net.Conn.
|
// NetConn returns the underlying net.Conn.
|
||||||
|
@@ -23,10 +23,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
rconn, err := gortsplib.NewConnClient(gortsplib.ConnClientConf{Conn: conn})
|
rconn := gortsplib.NewConnClient(gortsplib.ConnClientConf{Conn: conn})
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = rconn.Options(u)
|
_, err = rconn.Options(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -51,7 +48,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
frame := &gortsplib.InterleavedFrame{Content: make([]byte, 512*1024)}
|
frame := &gortsplib.InterleavedFrame{Content: make([]byte, 512*1024)}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
err := rconn.ReadFrame(frame)
|
err := rconn.ReadFrame(frame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -24,10 +24,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
rconn, err := gortsplib.NewConnClient(gortsplib.ConnClientConf{Conn: conn})
|
rconn := gortsplib.NewConnClient(gortsplib.ConnClientConf{Conn: conn})
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = rconn.Options(u)
|
_, err = rconn.Options(u)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user