mirror of
https://github.com/aler9/gortsplib
synced 2025-10-08 08:30:06 +08:00
set default read and write timeout to 10 secs
This commit is contained in:
@@ -102,11 +102,11 @@ 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, error) {
|
||||||
if conf.ReadTimeout == time.Duration(0) {
|
if conf.ReadTimeout == 0 {
|
||||||
conf.ReadTimeout = 10 * time.Second
|
conf.ReadTimeout = 10 * time.Second
|
||||||
}
|
}
|
||||||
if conf.WriteTimeout == time.Duration(0) {
|
if conf.WriteTimeout == 0 {
|
||||||
conf.WriteTimeout = 5 * time.Second
|
conf.WriteTimeout = 10 * time.Second
|
||||||
}
|
}
|
||||||
if conf.ReadBufferCount == 0 {
|
if conf.ReadBufferCount == 0 {
|
||||||
conf.ReadBufferCount = 1
|
conf.ReadBufferCount = 1
|
||||||
|
@@ -46,11 +46,11 @@ type ConnServer struct {
|
|||||||
|
|
||||||
// NewConnServer allocates a ConnServer.
|
// NewConnServer allocates a ConnServer.
|
||||||
func NewConnServer(conf ConnServerConf) *ConnServer {
|
func NewConnServer(conf ConnServerConf) *ConnServer {
|
||||||
if conf.ReadTimeout == time.Duration(0) {
|
if conf.ReadTimeout == 0 {
|
||||||
conf.ReadTimeout = 5 * time.Second
|
conf.ReadTimeout = 10 * time.Second
|
||||||
}
|
}
|
||||||
if conf.WriteTimeout == time.Duration(0) {
|
if conf.WriteTimeout == 0 {
|
||||||
conf.WriteTimeout = 5 * time.Second
|
conf.WriteTimeout = 10 * time.Second
|
||||||
}
|
}
|
||||||
if conf.ReadBufferCount == 0 {
|
if conf.ReadBufferCount == 0 {
|
||||||
conf.ReadBufferCount = 1
|
conf.ReadBufferCount = 1
|
||||||
|
@@ -44,7 +44,7 @@ func NewEncoder(relativeType uint8, config []byte) (*Encoder, error) {
|
|||||||
|
|
||||||
// Write encodes an AAC frame into RTP/AAC packets.
|
// Write encodes an AAC frame into RTP/AAC packets.
|
||||||
func (e *Encoder) Write(data []byte, timestamp time.Duration) ([][]byte, error) {
|
func (e *Encoder) Write(data []byte, timestamp time.Duration) ([][]byte, error) {
|
||||||
if e.started == time.Duration(0) {
|
if e.started == 0 {
|
||||||
e.started = timestamp
|
e.started = timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,7 +33,7 @@ func NewEncoder(relativeType uint8) (*Encoder, error) {
|
|||||||
|
|
||||||
// Write encodes NALUs into RTP/H264 packets.
|
// Write encodes NALUs into RTP/H264 packets.
|
||||||
func (e *Encoder) Write(nalus [][]byte, timestamp time.Duration) ([][]byte, error) {
|
func (e *Encoder) Write(nalus [][]byte, timestamp time.Duration) ([][]byte, error) {
|
||||||
if e.started == time.Duration(0) {
|
if e.started == 0 {
|
||||||
e.started = timestamp
|
e.started = timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user