RTSPtoWeb icon indicating copy to clipboard operation
RTSPtoWeb copied to clipboard

udp port range not work

Open mouuii opened this issue 1 year ago • 1 comments

I want to set the udp port range ,but doesn't work. so i change the code in rtspv2 pkg by 'replace github.com/deepch/vdk v0.0.27 => ./vdk', to use net.dail with local port as below 。 Do you have any ideal ? @deepch

func StreamServerRunStream(name string) (bool, error) {
	keyTest := time.NewTimer(20 * time.Second)
	Control := Storage.StreamControl(name)
	var preKeyTS = time.Duration(0)
	var Seq []*av.Packet
	RTSPClient, err := rtspv2.Dial(rtspv2.RTSPClientOptions{URL: Control.URL, DisableAudio: true, DialTimeout: 3 * time.Second, ReadWriteTimeout: time.Second * 5 * time.Second, Debug: Control.Debug})
	if err != nil {
		return false, errors.New("RTSP Client Error " + err.Error())
	}
	Storage.StreamStatus(name, ONLINE)
	defer func() {
		RTSPClient.Close()
		Storage.StreamStatus(name, OFFLINE)
	}()
     ... 
}

// in another repo vdk , package rtspv2
func Dial(options RTSPClientOptions) (*RTSPClient, error) {
         ...

	d := net.Dialer{Timeout: client.options.DialTimeout, LocalAddr: &net.TCPAddr{
		IP:   net.ParseIP("0.0.0.0"),
		Port: 30043,
	}}
	conn, err := d.Dial("tcp", client.pURL.Host)
	//conn, err := net.DialTimeout("tcp", client.pURL.Host, client.options.DialTimeout)


mouuii avatar Oct 09 '24 06:10 mouuii

ping @deepch

mouuii avatar Oct 17 '24 00:10 mouuii