diff --git a/conn-client.go b/conn-client.go index bec6ee7d..5ae43027 100644 --- a/conn-client.go +++ b/conn-client.go @@ -49,7 +49,7 @@ type ConnClient struct { } // 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) { conf.ReadTimeout = 5 * time.Second } @@ -61,7 +61,7 @@ func NewConnClient(conf ConnClientConf) (*ConnClient, error) { conf: conf, br: bufio.NewReaderSize(conf.Conn, clientReadBufferSize), bw: bufio.NewWriterSize(conf.Conn, clientWriteBufferSize), - }, nil + } } // NetConn returns the underlying net.Conn. diff --git a/examples/client-tcp.go b/examples/client-tcp.go index ca3f832e..6a414371 100644 --- a/examples/client-tcp.go +++ b/examples/client-tcp.go @@ -23,10 +23,7 @@ func main() { } defer conn.Close() - rconn, err := gortsplib.NewConnClient(gortsplib.ConnClientConf{Conn: conn}) - if err != nil { - panic(err) - } + rconn := gortsplib.NewConnClient(gortsplib.ConnClientConf{Conn: conn}) _, err = rconn.Options(u) if err != nil { @@ -51,7 +48,6 @@ func main() { } frame := &gortsplib.InterleavedFrame{Content: make([]byte, 512*1024)} - for { err := rconn.ReadFrame(frame) if err != nil { diff --git a/examples/client-udp.go b/examples/client-udp.go index b00d2cca..2846914c 100644 --- a/examples/client-udp.go +++ b/examples/client-udp.go @@ -24,10 +24,7 @@ func main() { } defer conn.Close() - rconn, err := gortsplib.NewConnClient(gortsplib.ConnClientConf{Conn: conn}) - if err != nil { - panic(err) - } + rconn := gortsplib.NewConnClient(gortsplib.ConnClientConf{Conn: conn}) _, err = rconn.Options(u) if err != nil {