add options
This commit is contained in:
parent
23ad40b14b
commit
3c9911e11b
@ -61,8 +61,8 @@ type RTSPClient struct {
|
|||||||
pURL *url.URL
|
pURL *url.URL
|
||||||
headers map[string]string
|
headers map[string]string
|
||||||
Signals chan int
|
Signals chan int
|
||||||
OutgoingProxy chan *[]byte
|
OutgoingProxyQueue chan *[]byte
|
||||||
OutgoingPacket chan *av.Packet
|
OutgoingPacketQueue chan *av.Packet
|
||||||
clientDigest bool
|
clientDigest bool
|
||||||
clientBasic bool
|
clientBasic bool
|
||||||
fuStarted bool
|
fuStarted bool
|
||||||
@ -79,14 +79,15 @@ type RTSPClientOptions struct {
|
|||||||
DialTimeout time.Duration
|
DialTimeout time.Duration
|
||||||
ReadWriteTimeout time.Duration
|
ReadWriteTimeout time.Duration
|
||||||
DisableAudio bool
|
DisableAudio bool
|
||||||
|
OutgoingProxy bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func Dial(options RTSPClientOptions) (*RTSPClient, error) {
|
func Dial(options RTSPClientOptions) (*RTSPClient, error) {
|
||||||
client := &RTSPClient{
|
client := &RTSPClient{
|
||||||
headers: make(map[string]string),
|
headers: make(map[string]string),
|
||||||
Signals: make(chan int, 100),
|
Signals: make(chan int, 100),
|
||||||
OutgoingProxy: make(chan *[]byte, 3000),
|
OutgoingProxyQueue: make(chan *[]byte, 3000),
|
||||||
OutgoingPacket: make(chan *av.Packet, 3000),
|
OutgoingPacketQueue: make(chan *av.Packet, 3000),
|
||||||
BufferRtpPacket: bytes.NewBuffer([]byte{}),
|
BufferRtpPacket: bytes.NewBuffer([]byte{}),
|
||||||
videoID: 0,
|
videoID: 0,
|
||||||
audioID: 2,
|
audioID: 2,
|
||||||
@ -205,22 +206,24 @@ func (client *RTSPClient) startStream() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
//atomic.AddInt64(&client.Bitrate, int64(length+4))
|
//atomic.AddInt64(&client.Bitrate, int64(length+4))
|
||||||
if len(client.OutgoingProxy) < 2000 {
|
if client.options.OutgoingProxy {
|
||||||
client.OutgoingProxy <- &content
|
if len(client.OutgoingProxyQueue) < 2000 {
|
||||||
|
client.OutgoingProxyQueue <- &content
|
||||||
} else {
|
} else {
|
||||||
client.Println("RTSP Client OutgoingProxy Chanel Full")
|
client.Println("RTSP Client OutgoingProxy Chanel Full")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pkt, got := client.RTPDemuxer(&content)
|
pkt, got := client.RTPDemuxer(&content)
|
||||||
if !got {
|
if !got {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, i2 := range pkt {
|
for _, i2 := range pkt {
|
||||||
if len(client.OutgoingPacket) > 2000 {
|
if len(client.OutgoingPacketQueue) > 2000 {
|
||||||
client.Println("RTSP Client OutgoingPacket Chanel Full")
|
client.Println("RTSP Client OutgoingPacket Chanel Full")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
client.OutgoingPacket <- i2
|
client.OutgoingPacketQueue <- i2
|
||||||
}
|
}
|
||||||
case 0x52:
|
case 0x52:
|
||||||
var responseTmp []byte
|
var responseTmp []byte
|
||||||
|
Loading…
Reference in New Issue
Block a user