mirror of
				https://github.com/aler9/gortsplib
				synced 2025-10-31 02:26:57 +08:00 
			
		
		
		
	remove serverConnTrack.proto
This commit is contained in:
		| @@ -56,7 +56,6 @@ func (s ServerConnState) String() string { | |||||||
| } | } | ||||||
|  |  | ||||||
| type serverConnTrack struct { | type serverConnTrack struct { | ||||||
| 	proto    StreamProtocol |  | ||||||
| 	rtpPort  int | 	rtpPort  int | ||||||
| 	rtcpPort int | 	rtcpPort int | ||||||
| } | } | ||||||
| @@ -262,8 +261,8 @@ func (sc *ServerConn) frameModeDisable() { | |||||||
| 		sc.nextFramesEnabled = false | 		sc.nextFramesEnabled = false | ||||||
| 		sc.readTimeoutEnabled = false | 		sc.readTimeoutEnabled = false | ||||||
|  |  | ||||||
|  | 		if *sc.tracksProtocol == StreamProtocolUDP { | ||||||
| 			for _, track := range sc.tracks { | 			for _, track := range sc.tracks { | ||||||
| 			if track.proto == StreamProtocolUDP { |  | ||||||
| 				sc.conf.UDPRTPListener.removePublisher(sc.ip(), track.rtpPort) | 				sc.conf.UDPRTPListener.removePublisher(sc.ip(), track.rtpPort) | ||||||
| 				sc.conf.UDPRTCPListener.removePublisher(sc.ip(), track.rtcpPort) | 				sc.conf.UDPRTCPListener.removePublisher(sc.ip(), track.rtcpPort) | ||||||
| 			} | 			} | ||||||
| @@ -478,7 +477,6 @@ func (sc *ServerConn) handleRequest(req *base.Request) (*base.Response, error) { | |||||||
|  |  | ||||||
| 				if th.Protocol == StreamProtocolUDP { | 				if th.Protocol == StreamProtocolUDP { | ||||||
| 					sc.tracks[trackID] = serverConnTrack{ | 					sc.tracks[trackID] = serverConnTrack{ | ||||||
| 						proto:    StreamProtocolUDP, |  | ||||||
| 						rtpPort:  th.ClientPorts[0], | 						rtpPort:  th.ClientPorts[0], | ||||||
| 						rtcpPort: th.ClientPorts[1], | 						rtcpPort: th.ClientPorts[1], | ||||||
| 					} | 					} | ||||||
| @@ -494,9 +492,7 @@ func (sc *ServerConn) handleRequest(req *base.Request) (*base.Response, error) { | |||||||
| 					}.Write() | 					}.Write() | ||||||
|  |  | ||||||
| 				} else { | 				} else { | ||||||
| 					sc.tracks[trackID] = serverConnTrack{ | 					sc.tracks[trackID] = serverConnTrack{} | ||||||
| 						proto: StreamProtocolTCP, |  | ||||||
| 					} |  | ||||||
|  |  | ||||||
| 					res.Header["Transport"] = headers.Transport{ | 					res.Header["Transport"] = headers.Transport{ | ||||||
| 						Protocol:       StreamProtocolTCP, | 						Protocol:       StreamProtocolTCP, | ||||||
| @@ -771,9 +767,9 @@ func (sc *ServerConn) WriteFrame(trackID int, streamType StreamType, payload []b | |||||||
| 	sc.writeMutex.Lock() | 	sc.writeMutex.Lock() | ||||||
| 	defer sc.writeMutex.Unlock() | 	defer sc.writeMutex.Unlock() | ||||||
|  |  | ||||||
|  | 	if *sc.tracksProtocol == StreamProtocolUDP { | ||||||
| 		track := sc.tracks[trackID] | 		track := sc.tracks[trackID] | ||||||
|  |  | ||||||
| 	if track.proto == StreamProtocolUDP { |  | ||||||
| 		if streamType == StreamTypeRTP { | 		if streamType == StreamTypeRTP { | ||||||
| 			return sc.conf.UDPRTPListener.write(sc.conf.WriteTimeout, payload, &net.UDPAddr{ | 			return sc.conf.UDPRTPListener.write(sc.conf.WriteTimeout, payload, &net.UDPAddr{ | ||||||
| 				IP:   sc.ip(), | 				IP:   sc.ip(), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 aler9
					aler9