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