mirror of
				https://github.com/Monibuca/plugin-rtsp.git
				synced 2025-10-31 10:56:41 +08:00 
			
		
		
		
	Compare commits
	
		
			53 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | ea5ea6f48a | ||
|   | beda2dd9e0 | ||
|   | 344ab6f463 | ||
|   | d5e73d11db | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 12350b8af0 | ||
|   | 3b671606b6 | ||
|   | 70321ccd1f | ||
|   | 5ddbd7a852 | ||
|   | f32f44db40 | ||
|   | b44efd9749 | ||
|   | 7f4bfe4c78 | ||
|   | 187335d311 | ||
|   | 1f3f4bfb0e | ||
|   | 3cbf22576b | ||
|   | 1206a4636f | ||
|   | 6063f42181 | ||
|   | 2e6679b3ea | ||
|   | 022857c3d7 | ||
|   | 0501a84da6 | ||
|   | 7d08e06922 | ||
|   | 754a28e506 | ||
|   | 9b058153d2 | ||
|   | ae37279dd1 | ||
|   | 93d6eedff2 | ||
|   | 2c1d908d7e | ||
|   | ced54a94a4 | ||
|   | f9bc450d01 | ||
|   | 44fb77d121 | ||
|   | 1b6981cccb | ||
|   | 2cd295d32c | ||
|   | 57ec489fef | ||
|   | a2100768b4 | ||
|   | 76956b16d1 | ||
|   | 91e1726920 | ||
|   | 4a0da71ee9 | ||
|   | 701d55469d | ||
|   | e273d0010e | ||
|   | 96834e26a1 | ||
|   | 7d0451c204 | ||
|   | c7c8858d36 | ||
|   | 731521f771 | ||
|   | 17334dd106 | ||
|   | 2d9838bdfa | ||
|   | bd5a146ea6 | ||
|   | e411d30e91 | ||
|   | 709a4cee7b | ||
|   | a90f52769d | ||
|   | 3764a26bbd | ||
|   | 2533ab2604 | ||
|   | db07f0d588 | ||
|   | f110513d70 | ||
|   | 8901f4c117 | ||
|   | 2f7c2de352 | 
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,2 +0,0 @@ | |||||||
| .vscode |  | ||||||
| node_modules |  | ||||||
							
								
								
									
										100
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										100
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,63 +1,89 @@ | |||||||
| # RTSP插件 | # RTSP插件 | ||||||
|  | rtsp插件提供rtsp协议的推拉流能力,以及向远程服务器推拉rtsp协议的能力。 | ||||||
| ## 插件地址 | ## 插件地址 | ||||||
|  |  | ||||||
| github.com/Monibuca/plugin-rtsp | https://github.com/Monibuca/plugin-rtsp | ||||||
|  |  | ||||||
| ## 插件引入 | ## 插件引入 | ||||||
| ```go | ```go | ||||||
| import ( | import ( | ||||||
|     _ "github.com/Monibuca/plugin-rtsp" |     _ "m7s.live/plugin/rtsp/v4" | ||||||
| ) | ) | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ## 默认插件配置 | ## 推拉地址形式 | ||||||
|  |  | ||||||
| ```toml |  | ||||||
| [RTSP] |  | ||||||
| # 端口接收推流 |  | ||||||
| ListenAddr = ":554" |  | ||||||
| Reconnect = true |  | ||||||
| [RTSP.AutoPullList] |  | ||||||
| "live/rtsp1" = "rtsp://admin:admin@192.168.1.212:554/cam/realmonitor?channel=1&subtype=1" |  | ||||||
| "live/rtsp2" = "rtsp://admin:admin@192.168.1.212:554/cam/realmonitor?channel=2&subtype=1" |  | ||||||
| ``` | ``` | ||||||
|  | rtsp://localhost/live/test | ||||||
|  | ``` | ||||||
|  | - `localhost`是m7s的服务器域名或者IP地址,默认端口`554`可以不写,否则需要写 | ||||||
|  | - `live`代表`appName` | ||||||
|  | - `test`代表`streamName` | ||||||
|  | - m7s中`live/test`将作为`streamPath`为流的唯一标识 | ||||||
|  |  | ||||||
| - `ListenAddr`是监听的地址 |  | ||||||
| - `Reconnect` 是否自动重连 |  | ||||||
| - `RTSP.AutoPullList` 可以配置多项,用于自动拉流,key是streamPath,value是远程rtsp地址 |  | ||||||
|  |  | ||||||
| ### 特殊功能 |  | ||||||
|  |  | ||||||
| 当自动拉流列表中当的streamPath为sub/xxx 这种形式的话,在gb28181的分屏显示时会优先采用rtsp流,已实现分屏观看子码流效果 |  | ||||||
| ## 插件功能 |  | ||||||
|  |  | ||||||
| ### 接收RTSP协议的推流 |  | ||||||
|  |  | ||||||
| 例如通过ffmpeg向m7s进行推流 | 例如通过ffmpeg向m7s进行推流 | ||||||
|  |  | ||||||
| ```bash | ```bash | ||||||
| ffmpeg -i **** rtsp://localhost/live/test | ffmpeg -i [视频源] -c:v h264 -c:a aac -f rtsp rtsp://localhost/live/test | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| 会在m7s内部形成一个名为live/test的流 | 会在m7s内部形成一个名为live/test的流 | ||||||
|  |  | ||||||
| ### 从远程拉取rtsp到m7s中 |  | ||||||
|  |  | ||||||
| 可调用接口 | 如果m7s中已经存在live/test流的话就可以用rtsp协议进行播放 | ||||||
| `/api/rtsp/pull?target=[RTSP地址]&streamPath=[流标识]` | ```bash | ||||||
|  | ffplay rtsp://localhost/live/test | ||||||
| ## 使用编程方式拉流 |  | ||||||
| ```go |  | ||||||
| new(RTSPClient).PullStream("live/user1","rtsp://xxx.xxx.xxx.xxx/live/user1")  |  | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ### 罗列所有的rtsp协议的流 |  | ||||||
|  |  | ||||||
| 可调用接口 | ## 配置 | ||||||
| `/api/rtsp/list` |  | ||||||
|  |  | ||||||
| ### 从m7s中拉取rtsp协议流 | ```yaml | ||||||
|  | rtsp: | ||||||
|  |     publish: | ||||||
|  |         pubaudio: true # 是否发布音频流 | ||||||
|  |         pubvideo: true # 是否发布视频流 | ||||||
|  |         kickexist: false # 剔出已经存在的发布者,用于顶替原有发布者 | ||||||
|  |         publishtimeout: 10s # 发布流默认过期时间,超过该时间发布者没有恢复流将被删除 | ||||||
|  |         delayclosetimeout: 0 # 自动关闭触发后延迟的时间(期间内如果有新的订阅则取消触发关闭),0为关闭该功能,保持连接。 | ||||||
|  |         waitclosetimeout: 0 # 发布者断开后等待时间,超过该时间发布者没有恢复流将被删除,0为关闭该功能,由订阅者决定是否删除 | ||||||
|  |         buffertime: 0 # 缓存时间,用于时光回溯,0为关闭缓存 | ||||||
|  |     subscribe: | ||||||
|  |         subaudio: true # 是否订阅音频流 | ||||||
|  |         subvideo: true # 是否订阅视频流 | ||||||
|  |         subaudioargname: ats # 订阅音频轨道参数名 | ||||||
|  |         subvideoargname: vts # 订阅视频轨道参数名 | ||||||
|  |         subdataargname: dts # 订阅数据轨道参数名 | ||||||
|  |         subaudiotracks: [] # 订阅音频轨道名称列表 | ||||||
|  |         subvideotracks: [] # 订阅视频轨道名称列表 | ||||||
|  |         submode: 0 # 订阅模式,0为跳帧追赶模式,1为不追赶(多用于录制),2为时光回溯模式 | ||||||
|  |         iframeonly: false # 只订阅关键帧 | ||||||
|  |         waittimeout: 10s # 等待发布者的超时时间,用于订阅尚未发布的流 | ||||||
|  |     pull: | ||||||
|  |         repull: 0 | ||||||
|  |         pullonstart: {} | ||||||
|  |         pullonsub: {} | ||||||
|  |     push: | ||||||
|  |         repush: 0 | ||||||
|  |         pushlist: {} | ||||||
|  |     listenaddr: :554 | ||||||
|  |     udpaddr: :8000 | ||||||
|  |     rtcpaddr: :8001 | ||||||
|  |     readbuffersize: 2048 | ||||||
|  |     pullprotocol: 'auto' | ||||||
|  | ``` | ||||||
|  | :::tip 配置覆盖 | ||||||
|  | publish | ||||||
|  | subscribe | ||||||
|  | 两项中未配置部分将使用全局配置 | ||||||
|  | ::: | ||||||
|  | ## API | ||||||
|  |  | ||||||
| 直接通过协议rtsp://xxx.xxx.xxx.xxx/live/user1 即可播放 | ### `rtsp/api/list` | ||||||
| > h265 编码拉流尚未实现,敬请期待 | 获取所有rtsp流 | ||||||
|  |  | ||||||
|  | ### `rtsp/api/pull?target=[RTSP地址]&streamPath=[流标识]` | ||||||
|  | 从远程拉取rtsp到m7s中 | ||||||
|  |  | ||||||
|  | ### `rtsp/api/push?target=[RTSP地址]&streamPath=[流标识]` | ||||||
|  | 将本地的流推送到远端 | ||||||
							
								
								
									
										294
									
								
								client.go
									
									
									
									
									
								
							
							
						
						
									
										294
									
								
								client.go
									
									
									
									
									
								
							| @@ -1,208 +1,152 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"errors" | 	"github.com/aler9/gortsplib/v2" | ||||||
| 	"time" | 	"github.com/aler9/gortsplib/v2/pkg/url" | ||||||
| 	"unsafe" | 	"go.uber.org/zap" | ||||||
|  | 	"m7s.live/engine/v4" | ||||||
| 	. "github.com/Monibuca/engine/v3" |  | ||||||
| 	. "github.com/Monibuca/utils/v3" |  | ||||||
| 	"github.com/Monibuca/utils/v3/codec" |  | ||||||
| 	"github.com/aler9/gortsplib" |  | ||||||
| 	"github.com/aler9/gortsplib/pkg/aac" |  | ||||||
| 	"github.com/aler9/gortsplib/pkg/base" |  | ||||||
| 	"github.com/pion/rtp" |  | ||||||
| 	"github.com/pion/rtp/codecs" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type RTSPClient struct { | type RTSPPuller struct { | ||||||
| 	RTSPublisher | 	RTSPPublisher | ||||||
| 	Transport         gortsplib.Transport | 	engine.Puller | ||||||
| 	*gortsplib.Client `json:"-"` | 	*gortsplib.Client `json:"-"` | ||||||
|  | 	gortsplib.Transport | ||||||
| } | } | ||||||
|  |  | ||||||
| // PullStream 从外部拉流 | func (p *RTSPPuller) Connect() error { | ||||||
| func (rtsp *RTSPClient) PullStream(streamPath string, rtspUrl string) (err error) { | 	switch rtspConfig.PullProtocol { | ||||||
| 	rtsp.Stream = &Stream{ | 	case "tcp", "TCP": | ||||||
| 		StreamPath: streamPath, | 		p.Transport = gortsplib.TransportTCP | ||||||
| 		Type:       "RTSP Pull", | 	case "udp", "UDP": | ||||||
| 		ExtraProp:  rtsp, | 		p.Transport = gortsplib.TransportUDP | ||||||
| 	} | 	default: | ||||||
| 	if result := rtsp.Publish(); result { | 		if p.Transport == gortsplib.TransportTCP { | ||||||
| 		rtsp.URL = rtspUrl | 			p.Transport = gortsplib.TransportUDP | ||||||
| 		if config.Reconnect { |  | ||||||
| 			go func() { |  | ||||||
| 				for rtsp.pullStream(); rtsp.Err() == nil; rtsp.pullStream() { |  | ||||||
| 					Printf("reconnecting:%s in 5 seconds", rtspUrl) |  | ||||||
| 					if rtsp.Transport == gortsplib.TransportTCP { |  | ||||||
| 						rtsp.Transport = gortsplib.TransportUDP |  | ||||||
| 		} else { | 		} else { | ||||||
| 						rtsp.Transport = gortsplib.TransportTCP | 			p.Transport = gortsplib.TransportTCP | ||||||
| 		} | 		} | ||||||
| 					time.Sleep(time.Second * 5) |  | ||||||
| 	} | 	} | ||||||
| 				if rtsp.IsTimeout { | 	p.Client = &gortsplib.Client{ | ||||||
| 					go rtsp.PullStream(streamPath, rtspUrl) | 		// OnPacketRTP: func(ctx *gortsplib.ClientOnPacketRTPCtx) { | ||||||
|  | 		// 	if p.RTSPPublisher.Tracks[ctx.TrackID] != nil { | ||||||
|  | 		// 		p.RTSPPublisher.Tracks[ctx.TrackID].WriteRTPPack(ctx.Packet) | ||||||
|  | 		// 	} | ||||||
|  | 		// }, | ||||||
|  | 		ReadBufferCount: rtspConfig.ReadBufferSize, | ||||||
|  | 		Transport:       &p.Transport, | ||||||
| 	} | 	} | ||||||
| 			}() |  | ||||||
| 		} else { | 	// parse URL | ||||||
| 			go rtsp.pullStream() | 	u, err := url.Parse(p.RemoteURL) | ||||||
| 		} | 	if err != nil { | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
| 	return errors.New("publish badname") |  | ||||||
| } |  | ||||||
| func (rtsp *RTSPClient) PushStream(streamPath string, rtspUrl string) (err error) { |  | ||||||
| 	if s := FindStream(streamPath); s != nil { |  | ||||||
| 		var tracks gortsplib.Tracks |  | ||||||
| 		var sub RTSPSubscriber |  | ||||||
| 		sub.Type = "RTSP push out" |  | ||||||
| 		sub.vt = s.WaitVideoTrack("h264", "h265") |  | ||||||
| 		sub.at = s.WaitAudioTrack("aac", "pcma", "pcmu") |  | ||||||
| 		ssrc := uintptr(unsafe.Pointer(&sub)) |  | ||||||
| 		var trackIds = 0 |  | ||||||
| 		if sub.vt != nil { |  | ||||||
| 			trackId := trackIds |  | ||||||
| 			var vtrack *gortsplib.Track |  | ||||||
| 			var vpacketer rtp.Packetizer |  | ||||||
| 			switch sub.vt.CodecID { |  | ||||||
| 			case codec.CodecID_H264: |  | ||||||
| 				if vtrack, err = gortsplib.NewTrackH264(96, &gortsplib.TrackConfigH264{ |  | ||||||
| 					SPS: sub.vt.ExtraData.NALUs[0], |  | ||||||
| 					PPS: sub.vt.ExtraData.NALUs[1], |  | ||||||
| 				}); err == nil { |  | ||||||
| 					vpacketer = rtp.NewPacketizer(1200, 96, uint32(ssrc), &codecs.H264Payloader{}, rtp.NewFixedSequencer(1), 90000) |  | ||||||
| 				} else { |  | ||||||
| 		return err | 		return err | ||||||
| 	} | 	} | ||||||
| 			case codec.CodecID_H265: | 	// connect to the server | ||||||
| 				vtrack = NewH265Track(96, sub.vt.ExtraData.NALUs) | 	if err = p.Client.Start(u.Scheme, u.Host); err != nil { | ||||||
| 				vpacketer = rtp.NewPacketizer(1200, 96, uint32(ssrc), &H265Payloader{}, rtp.NewFixedSequencer(1), 90000) | 		return err | ||||||
| 	} | 	} | ||||||
| 			var st uint32 | 	p.SetIO(p.Client) | ||||||
| 			onVideo := func(ts uint32, pack *VideoPack) { | 	return nil | ||||||
| 				for _, nalu := range pack.NALUs { |  | ||||||
| 					for _, pack := range vpacketer.Packetize(nalu, (ts-st)*90) { |  | ||||||
| 						rtp, _ := pack.Marshal() |  | ||||||
| 						rtsp.WritePacketRTP(trackId, rtp) |  | ||||||
| } | } | ||||||
| 				} |  | ||||||
| 				st = ts | func (p *RTSPPuller) Pull() (err error) { | ||||||
| 			} | 	u, _ := url.Parse(p.RemoteURL) | ||||||
| 			sub.OnVideo = func(ts uint32, pack *VideoPack) { | 	defer p.Stop() | ||||||
| 				if st = ts; st != 0 { | 	if _, err = p.Options(u); err != nil { | ||||||
| 					sub.OnVideo = onVideo | 		p.Error("Options", zap.Error(err)) | ||||||
| 				} |  | ||||||
| 				onVideo(ts, pack) |  | ||||||
| 			} |  | ||||||
| 			tracks = append(tracks, vtrack) |  | ||||||
| 			trackIds++ |  | ||||||
| 		} |  | ||||||
| 		if sub.at != nil { |  | ||||||
| 			var st uint32 |  | ||||||
| 			trackId := trackIds |  | ||||||
| 			switch sub.at.CodecID { |  | ||||||
| 			case codec.CodecID_PCMA, codec.CodecID_PCMU: |  | ||||||
| 				atrack := NewG711Track(97, map[byte]string{7: "pcma", 8: "pcmu"}[sub.at.CodecID]) |  | ||||||
| 				apacketizer := rtp.NewPacketizer(1200, 97, uint32(ssrc), &codecs.G711Payloader{}, rtp.NewFixedSequencer(1), 8000) |  | ||||||
| 				sub.OnAudio = func(ts uint32, pack *AudioPack) { |  | ||||||
| 					for _, pack := range apacketizer.Packetize(pack.Raw, (ts-st)*8) { |  | ||||||
| 						buf, _ := pack.Marshal() |  | ||||||
| 						rtsp.WritePacketRTP(trackId, buf) |  | ||||||
| 					} |  | ||||||
| 					st = ts |  | ||||||
| 				} |  | ||||||
| 				tracks = append(tracks, atrack) |  | ||||||
| 			case codec.CodecID_AAC: |  | ||||||
| 				var mpegConf aac.MPEG4AudioConfig |  | ||||||
| 				mpegConf.Decode(sub.at.ExtraData[2:]) |  | ||||||
| 				conf := &gortsplib.TrackConfigAAC{ |  | ||||||
| 					Type:              int(mpegConf.Type), |  | ||||||
| 					SampleRate:        mpegConf.SampleRate, |  | ||||||
| 					ChannelCount:      mpegConf.ChannelCount, |  | ||||||
| 					AOTSpecificConfig: mpegConf.AOTSpecificConfig, |  | ||||||
| 				} |  | ||||||
| 				if atrack, err := gortsplib.NewTrackAAC(97, conf); err == nil { |  | ||||||
| 					apacketizer := rtp.NewPacketizer(1200, 97, uint32(ssrc), &AACPayloader{}, rtp.NewFixedSequencer(1), uint32(mpegConf.SampleRate)) |  | ||||||
| 					sub.OnAudio = func(ts uint32, pack *AudioPack) { |  | ||||||
| 						for _, pack := range apacketizer.Packetize(pack.Raw, (ts-st)*uint32(mpegConf.SampleRate)/1000) { |  | ||||||
| 							buf, _ := pack.Marshal() |  | ||||||
| 							rtsp.WritePacketRTP(trackId, buf) |  | ||||||
| 						} |  | ||||||
| 						st = ts |  | ||||||
| 					} |  | ||||||
| 					tracks = append(tracks, atrack) |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		return rtsp.StartPublishing(rtspUrl, tracks) |  | ||||||
| 	} |  | ||||||
| 	return errors.New("stream not exist") |  | ||||||
| } |  | ||||||
| func (client *RTSPClient) pullStream() { |  | ||||||
| 	if client.Err() != nil { |  | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	client.Client = &gortsplib.Client{ | 	// find published tracks | ||||||
| 		OnPacketRTP: func(trackID int, payload []byte) { | 	tracks, baseURL, _, err := p.Describe(u) | ||||||
| 			if f := client.processFunc[trackID]; f != nil { | 	if err != nil { | ||||||
| 				var clone []byte | 		p.Error("Describe", zap.Error(err)) | ||||||
| 				f(append(clone, payload...)) | 		return | ||||||
| 	} | 	} | ||||||
| 		}, | 	p.tracks = tracks | ||||||
| 		Transport: &client.Transport, | 	err = p.SetTracks() | ||||||
|  | 	if err != nil { | ||||||
|  | 		p.Error("SetTracks", zap.Error(err)) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	if err = p.SetupAll(tracks, baseURL); err != nil { | ||||||
|  | 		p.Error("SetupAndPlay", zap.Error(err)) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	p.OnPacketRTPAny(p.OnPacket) | ||||||
|  | 	_, err = p.Play(nil) | ||||||
|  | 	if err != nil { | ||||||
|  | 		p.Error("Play", zap.Error(err)) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	return p.Wait() | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type RTSPPusher struct { | ||||||
|  | 	RTSPSubscriber | ||||||
|  | 	engine.Pusher | ||||||
|  | 	*gortsplib.Client | ||||||
|  | 	gortsplib.Transport | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (p *RTSPPusher) OnEvent(event any) { | ||||||
|  | 	switch v := event.(type) { | ||||||
|  | 	case engine.VideoRTP: | ||||||
|  | 		p.Client.WritePacketRTP(p.videoTrack, v.Packet) | ||||||
|  | 	case engine.AudioRTP: | ||||||
|  | 		p.Client.WritePacketRTP(p.audioTrack, v.Packet) | ||||||
|  | 	default: | ||||||
|  | 		p.RTSPSubscriber.OnEvent(event) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | func (p *RTSPPusher) Connect() error { | ||||||
|  | 	if p.Transport == gortsplib.TransportTCP { | ||||||
|  | 		p.Transport = gortsplib.TransportUDP | ||||||
|  | 	} else { | ||||||
|  | 		p.Transport = gortsplib.TransportTCP | ||||||
|  | 	} | ||||||
|  | 	p.Client = &gortsplib.Client{ | ||||||
|  | 		ReadBufferCount: rtspConfig.ReadBufferSize, | ||||||
|  | 		Transport:       &p.Transport, | ||||||
| 	} | 	} | ||||||
| 	// parse URL | 	// parse URL | ||||||
| 	u, err := base.ParseURL(client.URL) | 	u, err := url.Parse(p.RemoteURL) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		Printf("ParseURL:%s error:%v", client.URL, err) | 		p.Error("url.Parse", zap.Error(err)) | ||||||
| 		return | 		return err | ||||||
| 	} | 	} | ||||||
| 	// connect to the server | 	// connect to the server | ||||||
| 	if err = client.Start(u.Scheme, u.Host); err != nil { | 	if err = p.Client.Start(u.Scheme, u.Host); err != nil { | ||||||
| 		Printf("connect:%s error:%v", client.URL, err) | 		p.Error("Client.Start", zap.Error(err)) | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	p.SetIO(p.Client) | ||||||
|  | 	_, err = p.Client.Options(u) | ||||||
|  | 	return err | ||||||
|  | } | ||||||
|  | func (p *RTSPPusher) Push() (err error) { | ||||||
|  | 	var u *url.URL | ||||||
|  | 	u, err = url.Parse(p.RemoteURL) | ||||||
|  | 	// startTime := time.Now() | ||||||
|  | 	// for len(p.tracks) < 2 { | ||||||
|  | 	// 	if time.Sleep(time.Second); time.Since(startTime) > time.Second*10 { | ||||||
|  | 	// 		return fmt.Errorf("timeout") | ||||||
|  | 	// 	} | ||||||
|  | 	// } | ||||||
|  | 	if _, err = p.Announce(u, p.tracks); err != nil { | ||||||
|  | 		p.Error("Announce", zap.Error(err)) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	//client.close should be after connected! | 	err = p.SetupAll(p.tracks, u) | ||||||
| 	defer client.Client.Close() |  | ||||||
| 	var res *base.Response |  | ||||||
| 	if res, err = client.Options(u); err != nil { |  | ||||||
| 		Printf("option:%s error:%v", client.URL, err) |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
| 	Println(res) |  | ||||||
| 	// find published tracks |  | ||||||
| 	tracks, baseURL, res, err := client.Describe(u) |  | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		Printf("Describe:%s error:%v", client.URL, err) | 		p.Error("Setup", zap.Error(err)) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	Println(res) |  | ||||||
| 	if client.processFunc == nil { | 	if _, err = p.Record(); err != nil { | ||||||
| 		client.setTracks(tracks) | 		p.Error("Record", zap.Error(err)) | ||||||
| 	} |  | ||||||
| 	for _, track := range tracks { |  | ||||||
| 		if res, err = client.Setup(true, track, baseURL, 0, 0); err != nil { |  | ||||||
| 			Printf("Setup:%s error:%v", baseURL.String(), err) |  | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 		Println(res) | 	p.PlayRTP() | ||||||
| 	} |  | ||||||
| 	// start reading tracks |  | ||||||
| 	if res, err = client.Play(nil); err != nil { |  | ||||||
| 		Printf("Play:%s error:%v", baseURL.String(), err) |  | ||||||
| 	return | 	return | ||||||
| } | } | ||||||
| 	Println(res) |  | ||||||
| 	// wait until a fatal error |  | ||||||
| 	var fatalChan = make(chan error) |  | ||||||
| 	go func() { |  | ||||||
| 		fatalChan <- client.Wait() |  | ||||||
| 	}() |  | ||||||
| 	select { |  | ||||||
| 	case err := <-fatalChan: |  | ||||||
| 		Printf("Wait:%s error:%v", baseURL.String(), err) |  | ||||||
| 	case <-client.Done(): |  | ||||||
| 		Printf("client:%s done", client.URL) |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|   | |||||||
							
								
								
									
										50
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								go.mod
									
									
									
									
									
								
							| @@ -1,11 +1,47 @@ | |||||||
| module github.com/Monibuca/plugin-rtsp/v3 | module m7s.live/plugin/rtsp/v4 | ||||||
|  |  | ||||||
| go 1.16 | go 1.18 | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/Monibuca/engine/v3 v3.4.1 | 	github.com/aler9/gortsplib/v2 v2.1.0 | ||||||
| 	github.com/Monibuca/utils/v3 v3.0.5 | 	github.com/pion/rtp v1.7.13 | ||||||
| 	github.com/aler9/gortsplib v0.0.0-20211212220644-6f374e396529 | 	go.uber.org/zap v1.23.0 | ||||||
| 	github.com/pion/rtp v1.7.4 | 	m7s.live/engine/v4 v4.11.0 | ||||||
| 	github.com/pion/sdp/v3 v3.0.4 | ) | ||||||
|  |  | ||||||
|  | require ( | ||||||
|  | 	github.com/cnotch/ipchub v1.1.0 // indirect | ||||||
|  | 	github.com/go-ole/go-ole v1.2.6 // indirect | ||||||
|  | 	github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect | ||||||
|  | 	github.com/golang/mock v1.6.0 // indirect | ||||||
|  | 	github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect | ||||||
|  | 	github.com/google/uuid v1.3.0 // indirect | ||||||
|  | 	github.com/kr/text v0.2.0 // indirect | ||||||
|  | 	github.com/logrusorgru/aurora v2.0.3+incompatible // indirect | ||||||
|  | 	github.com/lucas-clemente/quic-go v0.31.0 // indirect | ||||||
|  | 	github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect | ||||||
|  | 	github.com/marten-seemann/qtls-go1-18 v0.1.3 // indirect | ||||||
|  | 	github.com/marten-seemann/qtls-go1-19 v0.1.1 // indirect | ||||||
|  | 	github.com/mcuadros/go-defaults v1.2.0 // indirect | ||||||
|  | 	github.com/onsi/ginkgo/v2 v2.2.0 // indirect | ||||||
|  | 	github.com/pion/randutil v0.1.0 // indirect | ||||||
|  | 	github.com/pion/rtcp v1.2.10 // indirect | ||||||
|  | 	github.com/pion/sdp/v3 v3.0.6 // indirect | ||||||
|  | 	github.com/pion/webrtc/v3 v3.1.49 // indirect | ||||||
|  | 	github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect | ||||||
|  | 	github.com/q191201771/naza v0.30.8 // indirect | ||||||
|  | 	github.com/shirou/gopsutil/v3 v3.22.10 // indirect | ||||||
|  | 	github.com/tklauser/go-sysconf v0.3.11 // indirect | ||||||
|  | 	github.com/tklauser/numcpus v0.6.0 // indirect | ||||||
|  | 	github.com/yusufpapurcu/wmi v1.2.2 // indirect | ||||||
|  | 	go.uber.org/atomic v1.10.0 // indirect | ||||||
|  | 	go.uber.org/multierr v1.8.0 // indirect | ||||||
|  | 	golang.org/x/crypto v0.3.0 // indirect | ||||||
|  | 	golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 // indirect | ||||||
|  | 	golang.org/x/mod v0.7.0 // indirect | ||||||
|  | 	golang.org/x/net v0.7.0 // indirect | ||||||
|  | 	golang.org/x/sync v0.1.0 // indirect | ||||||
|  | 	golang.org/x/sys v0.5.0 // indirect | ||||||
|  | 	golang.org/x/tools v0.3.0 // indirect | ||||||
|  | 	gopkg.in/yaml.v3 v3.0.1 // indirect | ||||||
| ) | ) | ||||||
|   | |||||||
							
								
								
									
										266
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										266
									
								
								go.sum
									
									
									
									
									
								
							| @@ -1,14 +1,10 @@ | |||||||
| github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||||||
| github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= | github.com/aler9/gortsplib/v2 v2.1.0 h1:HKQjFugTGH32FScSXPL2p4SGLpxGBRnyBSzR3GKYG9U= | ||||||
| github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= | github.com/aler9/gortsplib/v2 v2.1.0/go.mod h1:jZy239Qg+C9OSvJrPs2vIPalm9/pam1ljFir5DdydnA= | ||||||
| github.com/Monibuca/engine/v3 v3.4.1 h1:Ap2VbwTkMUkv80NPeUX2sNdV5Vz5nPVoU/6RU51PSAc= | github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= | ||||||
| github.com/Monibuca/engine/v3 v3.4.1/go.mod h1:rgAUey5ziRhlh6WugWyA5fYKyGOvcwhtTMDk4sukE7E= | github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= | ||||||
| github.com/Monibuca/utils/v3 v3.0.5 h1:w14x0HkWTbF4MmHbINLlOwe4VJNoSOeaQChMk5E/4es= | github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= | ||||||
| github.com/Monibuca/utils/v3 v3.0.5/go.mod h1:RpNS95gapWs6gimwh8Xn2x72FN5tO7Powabj7dTFyvE= | github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= | ||||||
| github.com/aler9/gortsplib v0.0.0-20211212220644-6f374e396529 h1:j2tfs+eUubyZnuwmYWzK+IS681IixfUyD8bivz4sqAw= |  | ||||||
| github.com/aler9/gortsplib v0.0.0-20211212220644-6f374e396529/go.mod h1:fyQrQyHo8QvdR/h357tkv1g36VesZlzEPsdAu2VrHHc= |  | ||||||
| github.com/asticode/go-astikit v0.20.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0= |  | ||||||
| github.com/asticode/go-astits v1.10.0/go.mod h1:DkOWmBNQpnr9mv24KfZjq4JawCFX1FCqjLVGvO0DygQ= |  | ||||||
| github.com/cnotch/apirouter v0.0.0-20200731232942-89e243a791f3/go.mod h1:5deJPLON/x/s2dLOQfuKS0lenhOIT4xX0pvtN/OEIuY= | github.com/cnotch/apirouter v0.0.0-20200731232942-89e243a791f3/go.mod h1:5deJPLON/x/s2dLOQfuKS0lenhOIT4xX0pvtN/OEIuY= | ||||||
| github.com/cnotch/ipchub v1.1.0 h1:hH0lh2mU3AZXPiqMwA0pdtqrwo7PFIMRGush9OobMUs= | github.com/cnotch/ipchub v1.1.0 h1:hH0lh2mU3AZXPiqMwA0pdtqrwo7PFIMRGush9OobMUs= | ||||||
| github.com/cnotch/ipchub v1.1.0/go.mod h1:2PbeBs2q2VxxTVCn1eYCDwpAWuVXbq1+N0FU7GimOH4= | github.com/cnotch/ipchub v1.1.0/go.mod h1:2PbeBs2q2VxxTVCn1eYCDwpAWuVXbq1+N0FU7GimOH4= | ||||||
| @@ -17,85 +13,265 @@ github.com/cnotch/queue v0.0.0-20200326024423-6e88bdbf2ad4/go.mod h1:zOssjAlNusO | |||||||
| github.com/cnotch/queue v0.0.0-20201224060551-4191569ce8f6/go.mod h1:zOssjAlNusOxvtaqT+EMA+Iyi8rrtKr4/XfzN1Fgoeg= | github.com/cnotch/queue v0.0.0-20201224060551-4191569ce8f6/go.mod h1:zOssjAlNusOxvtaqT+EMA+Iyi8rrtKr4/XfzN1Fgoeg= | ||||||
| github.com/cnotch/scheduler v0.0.0-20200522024700-1d2da93eefc5/go.mod h1:F4GE3SZkJZ8an1Y0ZCqvSM3jeozNuKzoC67erG1PhIo= | github.com/cnotch/scheduler v0.0.0-20200522024700-1d2da93eefc5/go.mod h1:F4GE3SZkJZ8an1Y0ZCqvSM3jeozNuKzoC67erG1PhIo= | ||||||
| github.com/cnotch/xlog v0.0.0-20201208005456-cfda439cd3a0/go.mod h1:RW9oHsR79ffl3sR3yMGgxYupMn2btzdtJUwoxFPUE5E= | github.com/cnotch/xlog v0.0.0-20201208005456-cfda439cd3a0/go.mod h1:RW9oHsR79ffl3sR3yMGgxYupMn2btzdtJUwoxFPUE5E= | ||||||
| github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= | ||||||
| github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
|  | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||||
|  | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
| github.com/emitter-io/address v1.0.0/go.mod h1:GfZb5+S/o8694B1GMGK2imUYQyn2skszMvGNA5D84Ug= | github.com/emitter-io/address v1.0.0/go.mod h1:GfZb5+S/o8694B1GMGK2imUYQyn2skszMvGNA5D84Ug= | ||||||
| github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= | ||||||
| github.com/funny/slab v0.0.0-20180511031532-b1fad5e5d478 h1:Db9StoJ6RZN3YttC0Pm0I4Y5izITRYch3RMbT59BYN0= | github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= | ||||||
| github.com/funny/slab v0.0.0-20180511031532-b1fad5e5d478/go.mod h1:0j1+svBH8ABEIPdUP0AIg4qedsybnXGJBakCEw8cfoo= | github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= | ||||||
| github.com/funny/utest v0.0.0-20161029064919-43870a374500 h1:Z0r1CZnoIWFB/Uiwh1BU5FYmuFe6L5NPi6XWQEmsTRg= | github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= | ||||||
| github.com/funny/utest v0.0.0-20161029064919-43870a374500/go.mod h1:mUn39tBov9jKnTWV1RlOYoNzxdBFHiSzXWdY1FoNGGg= | github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= | ||||||
|  | github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= | ||||||
|  | github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= | ||||||
|  | github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= | ||||||
| github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= | ||||||
|  | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= | ||||||
|  | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= | ||||||
|  | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= | ||||||
|  | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= | ||||||
|  | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= | ||||||
|  | github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= | ||||||
|  | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= | ||||||
|  | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= | ||||||
|  | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= | ||||||
|  | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | ||||||
|  | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | ||||||
|  | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||||||
|  | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||||||
|  | github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||||||
|  | github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= | ||||||
|  | github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | ||||||
|  | github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= | ||||||
|  | github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= | ||||||
|  | github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= | ||||||
|  | github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= | ||||||
| github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= | ||||||
| github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= | github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= | ||||||
| github.com/icza/bitio v1.0.0 h1:squ/m1SHyFeCA6+6Gyol1AxV9nmPPlJFT8c2vKdj3U8= | github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= | ||||||
| github.com/icza/bitio v1.0.0/go.mod h1:0jGnlLAx8MKMr9VGnn/4YrvZiprkvBelsVIbA9Jjr9A= |  | ||||||
| github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6 h1:8UsGZ2rr2ksmEru6lToqnXgA8Mz1DP11X4zSJ159C3k= |  | ||||||
| github.com/icza/mighty v0.0.0-20180919140131-cfd07d671de6/go.mod h1:xQig96I1VNBDIWGCdTt54nHt6EeI639SmHycLYL7FkA= |  | ||||||
| github.com/kelindar/process v0.0.0-20170730150328-69a29e249ec3/go.mod h1:+lTCLnZFXOkqwD8sLPl6u4erAc0cP8wFegQHfipz7KE= | github.com/kelindar/process v0.0.0-20170730150328-69a29e249ec3/go.mod h1:+lTCLnZFXOkqwD8sLPl6u4erAc0cP8wFegQHfipz7KE= | ||||||
| github.com/kelindar/rate v1.0.0/go.mod h1:AjT4G+hTItNwt30lucEGZIz8y7Uk5zPho6vurIZ+1Es= | github.com/kelindar/rate v1.0.0/go.mod h1:AjT4G+hTItNwt30lucEGZIz8y7Uk5zPho6vurIZ+1Es= | ||||||
| github.com/kelindar/tcp v1.0.0/go.mod h1:JB5hj1cshLU60XrLij2BBxW3JQ4hOye8vqbyvuKb52k= | github.com/kelindar/tcp v1.0.0/go.mod h1:JB5hj1cshLU60XrLij2BBxW3JQ4hOye8vqbyvuKb52k= | ||||||
|  | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||||||
|  | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||||||
|  | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||||||
|  | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | ||||||
|  | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | ||||||
| github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= | github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8= | ||||||
| github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= | github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= | ||||||
| github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= | github.com/lucas-clemente/quic-go v0.31.0 h1:MfNp3fk0wjWRajw6quMFA3ap1AVtlU+2mtwmbVogB2M= | ||||||
| github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= | github.com/lucas-clemente/quic-go v0.31.0/go.mod h1:0wFbizLgYzqHqtlyxyCaJKlE7bYgE6JQ+54TLd/Dq2g= | ||||||
| github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= | github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= | ||||||
| github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= | github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c h1:VtwQ41oftZwlMnOEbMWQtSEUgU64U4s+GHk7hZK+jtY= | ||||||
|  | github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE= | ||||||
|  | github.com/marten-seemann/qtls-go1-18 v0.1.3 h1:R4H2Ks8P6pAtUagjFty2p7BVHn3XiwDAl7TTQf5h7TI= | ||||||
|  | github.com/marten-seemann/qtls-go1-18 v0.1.3/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= | ||||||
|  | github.com/marten-seemann/qtls-go1-19 v0.1.1 h1:mnbxeq3oEyQxQXwI4ReCgW9DPoPR94sNlqWoDZnjRIE= | ||||||
|  | github.com/marten-seemann/qtls-go1-19 v0.1.1/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI= | ||||||
|  | github.com/mcuadros/go-defaults v1.2.0 h1:FODb8WSf0uGaY8elWJAkoLL0Ri6AlZ1bFlenk56oZtc= | ||||||
|  | github.com/mcuadros/go-defaults v1.2.0/go.mod h1:WEZtHEVIGYVDqkKSWBdWKUVdRyKlMfulPaGDWIVeCWY= | ||||||
|  | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= | ||||||
|  | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= | ||||||
|  | github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= | ||||||
|  | github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= | ||||||
| github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= | github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= | ||||||
| github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= | github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= | ||||||
|  | github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= | ||||||
|  | github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= | ||||||
|  | github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= | ||||||
|  | github.com/onsi/ginkgo/v2 v2.2.0 h1:3ZNA3L1c5FYDFTTxbFeVGGD8jYvjYauHD30YgLxVsNI= | ||||||
|  | github.com/onsi/ginkgo/v2 v2.2.0/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk= | ||||||
| github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= | github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= | ||||||
|  | github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= | ||||||
|  | github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= | ||||||
|  | github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= | ||||||
|  | github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q= | ||||||
|  | github.com/pion/datachannel v1.5.2/go.mod h1:FTGQWaHrdCwIJ1rw6xBIfZVkslikjShim5yr05XFuCQ= | ||||||
|  | github.com/pion/dtls/v2 v2.1.5/go.mod h1:BqCE7xPZbPSubGasRoDFJeTsyJtdD1FanJYL0JGheqY= | ||||||
|  | github.com/pion/ice/v2 v2.2.12/go.mod h1:z2KXVFyRkmjetRlaVRgjO9U3ShKwzhlUylvxKfHfd5A= | ||||||
|  | github.com/pion/interceptor v0.1.11/go.mod h1:tbtKjZY14awXd7Bq0mmWvgtHB5MDaRN7HV3OZ/uy7s8= | ||||||
|  | github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= | ||||||
|  | github.com/pion/mdns v0.0.5/go.mod h1:UgssrvdD3mxpi8tMxAXbsppL3vJ4Jipw1mTCW+al01g= | ||||||
| github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= | github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= | ||||||
| github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= | github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= | ||||||
| github.com/pion/rtcp v1.2.4 h1:NT3H5LkUGgaEapvp0HGik+a+CpflRF7KTD7H+o7OWIM= | github.com/pion/rtcp v1.2.9/go.mod h1:qVPhiCzAm4D/rxb6XzKeyZiQK69yJpbUDJSF7TgrqNo= | ||||||
| github.com/pion/rtcp v1.2.4/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0= | github.com/pion/rtcp v1.2.10 h1:nkr3uj+8Sp97zyItdN60tE/S6vk4al5CPRR6Gejsdjc= | ||||||
| github.com/pion/rtp v1.6.1/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= | github.com/pion/rtcp v1.2.10/go.mod h1:ztfEwXZNLGyF1oQDttz/ZKIBaeeg/oWbRYqzBM9TL1I= | ||||||
| github.com/pion/rtp v1.6.2/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= | github.com/pion/rtp v1.6.2/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= | ||||||
| github.com/pion/rtp v1.7.4 h1:4dMbjb1SuynU5OpA3kz1zHK+u+eOCQjW3MAeVHf1ODA= | github.com/pion/rtp v1.7.13 h1:qcHwlmtiI50t1XivvoawdCGTP4Uiypzfrsap+bijcoA= | ||||||
| github.com/pion/rtp v1.7.4/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= | github.com/pion/rtp v1.7.13/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= | ||||||
| github.com/pion/sdp/v3 v3.0.2/go.mod h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk= | github.com/pion/sctp v1.8.0/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s= | ||||||
| github.com/pion/sdp/v3 v3.0.4 h1:2Kf+dgrzJflNCSw3TV5v2VLeI0s/qkzy2r5jlR0wzf8= | github.com/pion/sctp v1.8.3/go.mod h1:OHbDjdk7kg+L+7TJim9q/qGVefdEJohuA2SZyihccgI= | ||||||
| github.com/pion/sdp/v3 v3.0.4/go.mod h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk= | github.com/pion/sdp/v3 v3.0.6 h1:WuDLhtuFUUVpTfus9ILC4HRyHsW6TdugjEX/QY9OiUw= | ||||||
|  | github.com/pion/sdp/v3 v3.0.6/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw= | ||||||
|  | github.com/pion/srtp/v2 v2.0.10/go.mod h1:XEeSWaK9PfuMs7zxXyiN252AHPbH12NX5q/CFDWtUuA= | ||||||
|  | github.com/pion/stun v0.3.5/go.mod h1:gDMim+47EeEtfWogA37n6qXZS88L5V6LqFcf+DZA2UA= | ||||||
|  | github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q= | ||||||
|  | github.com/pion/transport v0.12.3/go.mod h1:OViWW9SP2peE/HbwBvARicmAVnesphkNkCVZIWJ6q9A= | ||||||
|  | github.com/pion/transport v0.13.0/go.mod h1:yxm9uXpK9bpBBWkITk13cLo1y5/ur5VQpG22ny6EP7g= | ||||||
|  | github.com/pion/transport v0.13.1/go.mod h1:EBxbqzyv+ZrmDb82XswEE0BjfQFtuw1Nu6sjnjWCsGg= | ||||||
|  | github.com/pion/turn/v2 v2.0.8/go.mod h1:+y7xl719J8bAEVpSXBXvTxStjJv3hbz9YFflvkpcGPw= | ||||||
|  | github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M= | ||||||
|  | github.com/pion/webrtc/v3 v3.1.49 h1:rbsNGxK9jMYts+xE6zYAJMUQHnGwmk/JYze8yttW+to= | ||||||
|  | github.com/pion/webrtc/v3 v3.1.49/go.mod h1:kHf/o47QW4No1rgpsFux/h7lUhtUnwFnSFDZOXeLapw= | ||||||
| github.com/pixelbender/go-sdp v1.1.0/go.mod h1:6IBlz9+BrUHoFTea7gcp4S54khtOhjCW/nVDLhmZBAs= | github.com/pixelbender/go-sdp v1.1.0/go.mod h1:6IBlz9+BrUHoFTea7gcp4S54khtOhjCW/nVDLhmZBAs= | ||||||
| github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= | ||||||
| github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= |  | ||||||
| github.com/pkg/profile v1.4.0/go.mod h1:NWz/XGvpEW1FyYQ7fCx4dqYBLlfTcE+A9FLAkNKqjFE= |  | ||||||
| github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||||||
| github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||||||
| github.com/q191201771/naza v0.19.1 h1:4KLcxT2CHztO+7miPRtBG3FFgadSQYQw1gPPPKN7rnY= | github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= | ||||||
| github.com/q191201771/naza v0.19.1/go.mod h1:5LeGupZZFtYP1g/S203n9vXoUNVdlRnPIfM6rExjqt0= | github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c h1:NRoLoZvkBTKvR5gQLgA3e0hqjkY9u1wm+iOL45VN/qI= | ||||||
|  | github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= | ||||||
|  | github.com/q191201771/naza v0.30.8 h1:Lhh29o65C4PmTDj2l+eKfsw9dddpgWZk4bFICtcnSaA= | ||||||
|  | github.com/q191201771/naza v0.30.8/go.mod h1:n+dpJjQSh90PxBwxBNuifOwQttywvSIN5TkWSSYCeBk= | ||||||
|  | github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= | ||||||
|  | github.com/shirou/gopsutil/v3 v3.22.10 h1:4KMHdfBRYXGF9skjDWiL4RA2N+E8dRdodU/bOZpPoVg= | ||||||
|  | github.com/shirou/gopsutil/v3 v3.22.10/go.mod h1:QNza6r4YQoydyCfo6rH0blGfKahgibh4dQmV5xdFkQk= | ||||||
| github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518/go.mod h1:CKI4AZ4XmGV240rTHfO0hfE83S6/a3/Q1siZJ/vXf7A= | github.com/sqs/goreturns v0.0.0-20181028201513-538ac6014518/go.mod h1:CKI4AZ4XmGV240rTHfO0hfE83S6/a3/Q1siZJ/vXf7A= | ||||||
| github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||||
| github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= | ||||||
|  | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= | ||||||
|  | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||||||
| github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= | ||||||
| github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= |  | ||||||
| github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||||||
|  | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||||||
|  | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= | ||||||
|  | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= | ||||||
|  | github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= | ||||||
|  | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= | ||||||
|  | github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= | ||||||
|  | github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= | ||||||
|  | github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= | ||||||
|  | github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= | ||||||
|  | github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= | ||||||
|  | github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= | ||||||
|  | github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= | ||||||
|  | github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= | ||||||
|  | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= | ||||||
|  | github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= | ||||||
|  | github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= | ||||||
|  | go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= | ||||||
|  | go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= | ||||||
|  | go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= | ||||||
|  | go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= | ||||||
|  | go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= | ||||||
|  | go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= | ||||||
|  | go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= | ||||||
|  | go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY= | ||||||
| golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||||
|  | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||||||
|  | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | ||||||
| golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= | ||||||
|  | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | ||||||
|  | golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= | ||||||
|  | golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= | ||||||
|  | golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= | ||||||
|  | golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= | ||||||
|  | golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 h1:yZNXmy+j/JpX19vZkVktWqAo7Gny4PBWYYK3zskGpx4= | ||||||
|  | golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= | ||||||
|  | golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= | ||||||
|  | golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= | ||||||
|  | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= | ||||||
|  | golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= | ||||||
|  | golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= | ||||||
| golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | ||||||
| golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||||||
| golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||||
| golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= | ||||||
|  | golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= | ||||||
|  | golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= | ||||||
|  | golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | ||||||
|  | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= | ||||||
|  | golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= | ||||||
|  | golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= | ||||||
|  | golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
|  | golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||||||
|  | golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= | ||||||
|  | golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= | ||||||
|  | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= | ||||||
|  | golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= | ||||||
|  | golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= | ||||||
|  | golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= | ||||||
| golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
|  | golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
|  | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
|  | golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= | ||||||
|  | golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
| golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||||
|  | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= | golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
| golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||||
|  | golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= | ||||||
|  | golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
| golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= | golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= | ||||||
| golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | ||||||
|  | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= | ||||||
|  | golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= | ||||||
| golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||||||
|  | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||||||
| golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||||||
|  | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= | ||||||
|  | golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= | ||||||
|  | golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= | ||||||
| golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
|  | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | ||||||
|  | golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= | ||||||
|  | golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= | ||||||
|  | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= | ||||||
|  | golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= | ||||||
|  | golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= | ||||||
|  | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||||||
|  | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||||||
|  | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||||||
|  | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||||||
|  | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= | ||||||
|  | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= | ||||||
|  | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= | ||||||
|  | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= | ||||||
|  | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= | ||||||
|  | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= | ||||||
|  | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= | ||||||
|  | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= | ||||||
|  | google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= | ||||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
|  | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
|  | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= | ||||||
|  | gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
| gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= | ||||||
| gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= | gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= | ||||||
| gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= | ||||||
| gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||||
| gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||||
| gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= | gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||||
|  | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||||
|  | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= | ||||||
| gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||||
|  | gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||||
|  | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||||||
|  | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||||
|  | m7s.live/engine/v4 v4.11.0 h1:YbL1H+FtVlTKfi3WE4bk3fcmf4HrkTKygupGUCLdjvo= | ||||||
|  | m7s.live/engine/v4 v4.11.0/go.mod h1:dx52RjysN9uocotAP2caLyb6j2uWwjcnstOy8C/U8sU= | ||||||
|   | |||||||
							
								
								
									
										185
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										185
									
								
								main.go
									
									
									
									
									
								
							| @@ -1,112 +1,111 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" |  | ||||||
| 	"fmt" |  | ||||||
| 	"log" |  | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  | 	"strconv" | ||||||
|  | 	"sync" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	. "github.com/Monibuca/engine/v3" | 	"github.com/aler9/gortsplib/v2" | ||||||
| 	. "github.com/Monibuca/utils/v3" | 	"go.uber.org/zap" | ||||||
| 	"github.com/aler9/gortsplib" | 	. "m7s.live/engine/v4" | ||||||
|  | 	"m7s.live/engine/v4/config" | ||||||
|  | 	"m7s.live/engine/v4/util" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var config = struct { | type RTSPConfig struct { | ||||||
|  | 	config.Publish | ||||||
|  | 	config.Subscribe | ||||||
|  | 	config.Pull | ||||||
|  | 	config.Push | ||||||
| 	ListenAddr     string | 	ListenAddr     string | ||||||
| 	UDPAddr        string | 	UDPAddr        string | ||||||
| 	RTCPAddr       string | 	RTCPAddr       string | ||||||
| 	Timeout      int | 	ReadBufferSize int | ||||||
| 	Reconnect    bool | 	PullProtocol   string //tcp、udp、 auto(default) | ||||||
| 	AutoPullList map[string]string | 	sync.Map | ||||||
| 	AutoPushList map[string]string |  | ||||||
| }{":554", ":8000", ":8001", 0, false, nil, nil} |  | ||||||
|  |  | ||||||
| var pconfig = PluginConfig{ |  | ||||||
| 	Name:   "RTSP", |  | ||||||
| 	Config: &config, |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func init() { | func (conf *RTSPConfig) OnEvent(event any) { | ||||||
| 	pconfig.Install(runPlugin) | 	switch v := event.(type) { | ||||||
| } | 	case FirstConfig: | ||||||
|  |  | ||||||
| func getRtspList() (info []*Stream) { |  | ||||||
| 	for _, s := range Streams.ToList() { |  | ||||||
| 		switch s.ExtraProp.(type) { |  | ||||||
| 		case *RTSPublisher: |  | ||||||
| 			info = append(info, s) |  | ||||||
| 		case *RTSPClient: |  | ||||||
| 			info = append(info, s) |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	return |  | ||||||
| } |  | ||||||
| func runPlugin() { |  | ||||||
| 	http.HandleFunc("/api/rtsp/list", func(w http.ResponseWriter, r *http.Request) { |  | ||||||
| 		CORS(w, r) |  | ||||||
| 		if r.URL.Query().Get("json") != "" { |  | ||||||
| 			if jsonData, err := json.Marshal(getRtspList()); err == nil { |  | ||||||
| 				w.Write(jsonData) |  | ||||||
| 			} else { |  | ||||||
| 				w.WriteHeader(500) |  | ||||||
| 			} |  | ||||||
| 			return |  | ||||||
| 		} |  | ||||||
| 		sse := NewSSE(w, r.Context()) |  | ||||||
| 		var err error |  | ||||||
| 		for tick := time.NewTicker(time.Second); err == nil; <-tick.C { |  | ||||||
| 			err = sse.WriteJSON(getRtspList()) |  | ||||||
| 		} |  | ||||||
| 	}) |  | ||||||
| 	http.HandleFunc("/api/rtsp/pull", func(w http.ResponseWriter, r *http.Request) { |  | ||||||
| 		CORS(w, r) |  | ||||||
| 		targetURL := r.URL.Query().Get("target") |  | ||||||
| 		streamPath := r.URL.Query().Get("streamPath") |  | ||||||
| 		save := r.URL.Query().Get("save") |  | ||||||
| 		if err := (&RTSPClient{Transport: gortsplib.TransportTCP}).PullStream(streamPath, targetURL); err == nil { |  | ||||||
| 			if save == "1" { |  | ||||||
| 				if config.AutoPullList == nil { |  | ||||||
| 					config.AutoPullList = make(map[string]string) |  | ||||||
| 				} |  | ||||||
| 				config.AutoPullList[streamPath] = targetURL |  | ||||||
| 				if err := pconfig.Save(); err != nil { |  | ||||||
| 					Println(err) |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 			w.Write([]byte(`{"code":0}`)) |  | ||||||
| 		} else { |  | ||||||
| 			w.Write([]byte(fmt.Sprintf(`{"code":1,"msg":"%s"}`, err.Error()))) |  | ||||||
| 		} |  | ||||||
| 	}) |  | ||||||
| 	for streamPath, url := range config.AutoPullList { |  | ||||||
| 		if err := (&RTSPClient{Transport: gortsplib.TransportTCP}).PullStream(streamPath, url); err != nil { |  | ||||||
| 			Println(err) |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	 |  | ||||||
| 	go AddHook(HOOK_PUBLISH, func(s *Stream) { |  | ||||||
| 		for streamPath, url := range config.AutoPushList { |  | ||||||
| 			if s.StreamPath == streamPath { |  | ||||||
| 				(&RTSPClient{}).PushStream(streamPath, url) |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	}) |  | ||||||
| 	if config.ListenAddr != "" { |  | ||||||
| 		go log.Fatal(ListenRtsp(config.ListenAddr)) |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| func ListenRtsp(addr string) error { |  | ||||||
| 	defer log.Println("rtsp server start!") |  | ||||||
| 		s := &gortsplib.Server{ | 		s := &gortsplib.Server{ | ||||||
| 		Handler:           &RTSPServer{}, | 			Handler:           conf, | ||||||
| 		RTSPAddress:       addr, | 			RTSPAddress:       conf.ListenAddr, | ||||||
| 		UDPRTPAddress:     config.UDPAddr, | 			UDPRTPAddress:     conf.UDPAddr, | ||||||
| 		UDPRTCPAddress:    config.RTCPAddr, | 			UDPRTCPAddress:    conf.RTCPAddr, | ||||||
| 			MulticastIPRange:  "224.1.0.0/16", | 			MulticastIPRange:  "224.1.0.0/16", | ||||||
| 			MulticastRTPPort:  8002, | 			MulticastRTPPort:  8002, | ||||||
| 			MulticastRTCPPort: 8003, | 			MulticastRTCPPort: 8003, | ||||||
| 		} | 		} | ||||||
| 	return s.StartAndWait() | 		if err := s.Start(); err != nil { | ||||||
|  | 			RTSPPlugin.Error("server start", zap.Error(err)) | ||||||
|  | 			v["enable"] = false | ||||||
|  | 		} | ||||||
|  | 		for streamPath, url := range conf.PullOnStart { | ||||||
|  | 			if err := RTSPPlugin.Pull(streamPath, url, new(RTSPPuller), 0); err != nil { | ||||||
|  | 				RTSPPlugin.Error("pull", zap.String("streamPath", streamPath), zap.String("url", url), zap.Error(err)) | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	case SEpublish: | ||||||
|  | 		for streamPath, url := range conf.PushList { | ||||||
|  | 			if streamPath == v.Stream.Path { | ||||||
|  | 				if err := RTSPPlugin.Push(streamPath, url, new(RTSPPusher), false); err != nil { | ||||||
|  | 					RTSPPlugin.Error("push", zap.String("streamPath", streamPath), zap.String("url", url), zap.Error(err)) | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	case *Stream: //按需拉流 | ||||||
|  | 		for streamPath, url := range conf.PullOnSub { | ||||||
|  | 			if streamPath == v.Path { | ||||||
|  | 				if err := RTSPPlugin.Pull(streamPath, url, new(RTSPPuller), 0); err != nil { | ||||||
|  | 					RTSPPlugin.Error("pull", zap.String("streamPath", streamPath), zap.String("url", url), zap.Error(err)) | ||||||
|  | 				} | ||||||
|  | 				break | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | var rtspConfig = &RTSPConfig{ | ||||||
|  | 	ListenAddr:     ":554", | ||||||
|  | 	UDPAddr:        ":8000", | ||||||
|  | 	RTCPAddr:       ":8001", | ||||||
|  | 	ReadBufferSize: 2048, | ||||||
|  | } | ||||||
|  | var RTSPPlugin = InstallPlugin(rtspConfig) | ||||||
|  |  | ||||||
|  | func filterStreams() (ss []*Stream) { | ||||||
|  | 	Streams.RLock() | ||||||
|  | 	defer Streams.RUnlock() | ||||||
|  | 	for _, s := range Streams.Map { | ||||||
|  | 		switch s.Publisher.(type) { | ||||||
|  | 		case *RTSPPublisher, *RTSPPuller: | ||||||
|  | 			ss = append(ss, s) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (*RTSPConfig) API_list(w http.ResponseWriter, r *http.Request) { | ||||||
|  | 	util.ReturnJson(filterStreams, time.Second, w, r) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (*RTSPConfig) API_Pull(rw http.ResponseWriter, r *http.Request) { | ||||||
|  | 	save, _ := strconv.Atoi(r.URL.Query().Get("save")) | ||||||
|  | 	err := RTSPPlugin.Pull(r.URL.Query().Get("streamPath"), r.URL.Query().Get("target"), new(RTSPPuller), save) | ||||||
|  | 	if err != nil { | ||||||
|  | 		http.Error(rw, err.Error(), http.StatusBadRequest) | ||||||
|  | 	} else { | ||||||
|  | 		rw.Write([]byte("ok")) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (*RTSPConfig) API_Push(rw http.ResponseWriter, r *http.Request) { | ||||||
|  | 	err := RTSPPlugin.Push(r.URL.Query().Get("streamPath"), r.URL.Query().Get("target"), new(RTSPPusher), r.URL.Query().Has("save")) | ||||||
|  | 	if err != nil { | ||||||
|  | 		http.Error(rw, err.Error(), http.StatusBadRequest) | ||||||
|  | 	} else { | ||||||
|  | 		rw.Write([]byte("ok")) | ||||||
|  | 	} | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								payloader.go
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								payloader.go
									
									
									
									
									
								
							| @@ -1,24 +0,0 @@ | |||||||
| package rtsp |  | ||||||
|  |  | ||||||
| // AACayloader payloads AAC packets |  | ||||||
| type AACPayloader struct{} |  | ||||||
|  |  | ||||||
| // Payload fragments an AAC packet across one or more byte arrays |  | ||||||
| func (p *AACPayloader) Payload(mtu uint16, payload []byte) [][]byte { |  | ||||||
| 	var out [][]byte |  | ||||||
| 	o := make([]byte, len(payload)+4) |  | ||||||
| 	//AU_HEADER_LENGTH,因为单位是bit, 除以8就是auHeader的字节长度;又因为单个auheader字节长度2字节,所以再除以2就是auheader的个数。 |  | ||||||
| 	o[0] = 0x00 //高位 |  | ||||||
| 	o[1] = 0x10 //低位 |  | ||||||
| 	//AU_HEADER |  | ||||||
| 	o[2] = (byte)((len(payload) & 0x1fe0) >> 5) //高位 |  | ||||||
| 	o[3] = (byte)((len(payload) & 0x1f) << 3)   //低位 |  | ||||||
| 	copy(o[4:], payload) |  | ||||||
| 	return append(out, o) |  | ||||||
| } |  | ||||||
|  |  | ||||||
| type H265Payloader struct{} |  | ||||||
|  |  | ||||||
| func (p *H265Payloader) Payload(mtu uint16, payload []byte) [][]byte { |  | ||||||
| 	return nil |  | ||||||
| } |  | ||||||
							
								
								
									
										175
									
								
								publisher.go
									
									
									
									
									
								
							
							
						
						
									
										175
									
								
								publisher.go
									
									
									
									
									
								
							| @@ -1,121 +1,78 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"encoding/base64" | 	"github.com/aler9/gortsplib/v2/pkg/codecs/mpeg4audio" | ||||||
| 	"encoding/hex" | 	"github.com/aler9/gortsplib/v2/pkg/format" | ||||||
| 	"strconv" | 	"github.com/aler9/gortsplib/v2/pkg/media" | ||||||
| 	"strings" | 	"github.com/pion/rtp" | ||||||
|  | 	"go.uber.org/zap" | ||||||
| 	. "github.com/Monibuca/engine/v3" | 	. "m7s.live/engine/v4" | ||||||
| 	. "github.com/Monibuca/utils/v3" | 	"m7s.live/engine/v4/common" | ||||||
| 	"github.com/aler9/gortsplib" | 	. "m7s.live/engine/v4/track" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type RTSPublisher struct { | type RTSPPublisher struct { | ||||||
| 	*Stream     `json:"-"` | 	Publisher | ||||||
| 	stream      *gortsplib.ServerStream | 	Tracks map[*media.Media]common.AVTrack `json:"-"` | ||||||
| 	processFunc []func([]byte) | 	RTSPIO | ||||||
| } | } | ||||||
|  |  | ||||||
| func (p *RTSPublisher) setTracks(tracks gortsplib.Tracks) { | func (p *RTSPPublisher) SetTracks() error { | ||||||
| 	if p.processFunc != nil { | 	p.Tracks = make(map[*media.Media]common.AVTrack, len(p.tracks)) | ||||||
| 		p.processFunc = p.processFunc[:len(tracks)] | 	defer func() { | ||||||
| 		return | 		for _, track := range p.Tracks { | ||||||
| 	} else { | 			p.Info("set track", zap.String("name", track.GetBase().Name)) | ||||||
| 		p.processFunc = make([]func([]byte), len(tracks)) |  | ||||||
| 		} | 		} | ||||||
| 	for i, track := range tracks { | 	}() | ||||||
| 		v, ok := track.Media.Attribute("rtpmap") | 	for _, track := range p.tracks { | ||||||
| 		if !ok { | 		for _, forma := range track.Formats { | ||||||
| 			continue | 			switch f := forma.(type) { | ||||||
|  | 			case *format.H264: | ||||||
|  | 				vt := NewH264(p.Stream, f.PayloadType()) | ||||||
|  | 				p.Tracks[track] = vt | ||||||
|  | 				if len(f.SPS) > 0 { | ||||||
|  | 					vt.WriteSliceBytes(f.SPS) | ||||||
|  | 				} | ||||||
|  | 				if len(f.PPS) > 0 { | ||||||
|  | 					vt.WriteSliceBytes(f.PPS) | ||||||
|  | 				} | ||||||
|  | 			case *format.H265: | ||||||
|  | 				vt := NewH265(p.Stream, f.PayloadType()) | ||||||
|  | 				p.Tracks[track] = vt | ||||||
|  | 				if len(f.VPS) > 0 { | ||||||
|  | 					vt.WriteSliceBytes(f.VPS) | ||||||
|  | 				} | ||||||
|  | 				if len(f.SPS) > 0 { | ||||||
|  | 					vt.WriteSliceBytes(f.SPS) | ||||||
|  | 				} | ||||||
|  | 				if len(f.PPS) > 0 { | ||||||
|  | 					vt.WriteSliceBytes(f.PPS) | ||||||
|  | 				} | ||||||
|  | 			case *format.MPEG4Audio: | ||||||
|  | 				at := NewAAC(p.Stream, f.PayloadType(), uint32(f.Config.SampleRate)) | ||||||
|  | 				p.Tracks[track] = at | ||||||
|  | 				at.IndexDeltaLength = f.IndexDeltaLength | ||||||
|  | 				at.IndexLength = f.IndexLength | ||||||
|  | 				at.SizeLength = f.SizeLength | ||||||
|  | 				if f.Config.Type == mpeg4audio.ObjectTypeAACLC { | ||||||
|  | 					at.Mode = 1 | ||||||
|  | 				} | ||||||
|  | 				at.Channels = uint8(f.Config.ChannelCount) | ||||||
|  | 				asc, _ := f.Config.Marshal() | ||||||
|  | 				// 复用AVCC写入逻辑,解析出AAC的配置信息 | ||||||
|  | 				at.WriteSequenceHead(append([]byte{0xAF, 0x00}, asc...)) | ||||||
|  | 			case *format.G711: | ||||||
|  | 				at := NewG711(p.Stream, !f.MULaw, f.PayloadType(), uint32(f.ClockRate())) | ||||||
|  | 				p.Tracks[track] = at | ||||||
|  | 				at.AVCCHead = []byte{(byte(at.CodecID) << 4) | (1 << 1)} | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| 		fmtp := make(map[string]string) | func (p *RTSPPublisher) OnPacket(m *media.Media, f format.Format, pack *rtp.Packet) { | ||||||
| 		if v, ok := track.Media.Attribute("fmtp"); ok { | 	if t, ok := p.Tracks[m]; ok { | ||||||
| 			if tmp := strings.SplitN(v, " ", 2); len(tmp) == 2 { | 		t.WriteRTPPack(pack) | ||||||
| 				for _, kv := range strings.Split(tmp[1], ";") { |  | ||||||
| 					kv = strings.Trim(kv, " ") |  | ||||||
|  |  | ||||||
| 					if len(kv) == 0 { |  | ||||||
| 						continue |  | ||||||
| 					} |  | ||||||
| 					tmp := strings.SplitN(kv, "=", 2) |  | ||||||
| 					if len(tmp) == 2 { |  | ||||||
| 						fmtp[strings.TrimSpace(tmp[0])] = tmp[1] |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		v = strings.TrimSpace(v) |  | ||||||
| 		vals := strings.Split(v, " ") |  | ||||||
| 		if len(vals) != 2 { |  | ||||||
| 			continue |  | ||||||
| 		} |  | ||||||
| 		timeScale := 0 |  | ||||||
| 		keyval := strings.Split(vals[1], "/") |  | ||||||
| 		if i, err := strconv.Atoi(keyval[1]); err == nil { |  | ||||||
| 			timeScale = i |  | ||||||
| 		} |  | ||||||
| 		if len(keyval) >= 2 { |  | ||||||
| 			Printf("track %d is %s", i, keyval[0]) |  | ||||||
| 			switch strings.ToLower(keyval[0]) { |  | ||||||
| 			case "h264": |  | ||||||
| 				vt := p.NewRTPVideo(7) |  | ||||||
| 				if conf, err := track.ExtractConfigH264(); err == nil { |  | ||||||
| 					vt.PushNalu(0, 0, conf.SPS, conf.PPS) |  | ||||||
| 				} |  | ||||||
| 				p.processFunc[i] = vt.Push |  | ||||||
| 			case "h265", "hevc": |  | ||||||
| 				vt := p.NewRTPVideo(12) |  | ||||||
| 				if v, ok := fmtp["sprop-vps"]; ok { |  | ||||||
| 					vps, _ := base64.StdEncoding.DecodeString(v) |  | ||||||
| 					vt.PushNalu(0, 0, vps) |  | ||||||
| 				} |  | ||||||
| 				if v, ok := fmtp["sprop-sps"]; ok { |  | ||||||
| 					sps, _ := base64.StdEncoding.DecodeString(v) |  | ||||||
| 					vt.PushNalu(0, 0, sps) |  | ||||||
| 				} |  | ||||||
| 				if v, ok := fmtp["sprop-pps"]; ok { |  | ||||||
| 					pps, _ := base64.StdEncoding.DecodeString(v) |  | ||||||
| 					vt.PushNalu(0, 0, pps) |  | ||||||
| 				} |  | ||||||
| 				p.processFunc[i] = vt.Push |  | ||||||
| 			case "pcma": |  | ||||||
| 				at := p.NewRTPAudio(7) |  | ||||||
| 				at.SoundRate = timeScale |  | ||||||
| 				at.SoundSize = 16 |  | ||||||
| 				if len(keyval) >= 3 { |  | ||||||
| 					x, _ := strconv.Atoi(keyval[2]) |  | ||||||
| 					at.Channels = byte(x) |  | ||||||
| 				} else { |  | ||||||
| 					at.Channels = 1 |  | ||||||
| 				} |  | ||||||
| 				at.ExtraData = []byte{(at.CodecID << 4) | (1 << 1)} |  | ||||||
| 				p.processFunc[i] = at.Push |  | ||||||
| 			case "pcmu": |  | ||||||
| 				at := p.NewRTPAudio(8) |  | ||||||
| 				at.SoundRate = timeScale |  | ||||||
| 				at.SoundSize = 16 |  | ||||||
| 				if len(keyval) >= 3 { |  | ||||||
| 					x, _ := strconv.Atoi(keyval[2]) |  | ||||||
| 					at.Channels = byte(x) |  | ||||||
| 				} else { |  | ||||||
| 					at.Channels = 1 |  | ||||||
| 				} |  | ||||||
| 				at.ExtraData = []byte{(at.CodecID << 4) | (1 << 1)} |  | ||||||
| 				p.processFunc[i] = at.Push |  | ||||||
| 			case "mpeg4-generic": |  | ||||||
| 				at := p.NewRTPAudio(0) |  | ||||||
| 				if config, ok := fmtp["config"]; ok { |  | ||||||
| 					asc, _ := hex.DecodeString(config) |  | ||||||
| 					at.SetASC(asc) |  | ||||||
| 				} else { |  | ||||||
| 					Println("aac no config") |  | ||||||
| 				} |  | ||||||
| 				at.SoundSize = 16 |  | ||||||
| 				p.processFunc[i] = at.Push |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										304
									
								
								server.go
									
									
									
									
									
								
							
							
						
						
									
										304
									
								
								server.go
									
									
									
									
									
								
							| @@ -1,256 +1,118 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"github.com/aler9/gortsplib/v2" | ||||||
| 	"sync" | 	"github.com/aler9/gortsplib/v2/pkg/base" | ||||||
| 	"unsafe" | 	"github.com/aler9/gortsplib/v2/pkg/media" | ||||||
|  | 	. "m7s.live/engine/v4" | ||||||
| 	"github.com/Monibuca/engine/v3" |  | ||||||
| 	. "github.com/Monibuca/utils/v3" |  | ||||||
| 	"github.com/Monibuca/utils/v3/codec" |  | ||||||
| 	"github.com/aler9/gortsplib" |  | ||||||
| 	"github.com/aler9/gortsplib/pkg/aac" |  | ||||||
| 	"github.com/aler9/gortsplib/pkg/base" |  | ||||||
| 	"github.com/pion/rtp" |  | ||||||
| 	"github.com/pion/rtp/codecs" |  | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // 接收RTSP推流:OnConnOpen->OnAnnounce->OnSetup->OnSessionOpen | type RTSPIO struct { | ||||||
| // 接收RTSP拉流:OnConnOpen->OnDescribe->OnSetup->OnSessionOpen | 	tracks     media.Medias | ||||||
| type RTSPServer struct { |  | ||||||
| 	sync.Map |  | ||||||
| } |  | ||||||
| type RTSPSubscriber struct { |  | ||||||
| 	stream     *gortsplib.ServerStream | 	stream     *gortsplib.ServerStream | ||||||
| 	engine.Subscriber | 	audioTrack *media.Media | ||||||
| 	vt *engine.VideoTrack | 	videoTrack *media.Media | ||||||
| 	at *engine.AudioTrack |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // called after a connection is opened. | func (conf *RTSPConfig) OnConnOpen(ctx *gortsplib.ServerHandlerOnConnOpenCtx) { | ||||||
| func (sh *RTSPServer) OnConnOpen(ctx *gortsplib.ServerHandlerOnConnOpenCtx) { | 	RTSPPlugin.Debug("conn opened") | ||||||
| 	Printf("rtsp conn opened") |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // called after a connection is closed. | func (conf *RTSPConfig) OnConnClose(ctx *gortsplib.ServerHandlerOnConnCloseCtx) { | ||||||
| func (sh *RTSPServer) OnConnClose(ctx *gortsplib.ServerHandlerOnConnCloseCtx) { | 	RTSPPlugin.Debug("conn closed") | ||||||
| 	Printf("rtsp conn closed (%v)", ctx.Error) | 	if p, ok := conf.LoadAndDelete(ctx.Conn); ok { | ||||||
| 	if p, ok := sh.Load(ctx.Conn); ok { | 		p.(IIO).Stop() | ||||||
| 		switch v := p.(type) { |  | ||||||
| 		case *RTSPublisher: |  | ||||||
| 			v.Close() |  | ||||||
| 		case *RTSPSubscriber: |  | ||||||
| 			v.Close() |  | ||||||
| 		} |  | ||||||
| 		sh.Delete(ctx.Conn) |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| // called after a session is opened. | func (conf *RTSPConfig) OnSessionOpen(ctx *gortsplib.ServerHandlerOnSessionOpenCtx) { | ||||||
| func (sh *RTSPServer) OnSessionOpen(ctx *gortsplib.ServerHandlerOnSessionOpenCtx) { | 	RTSPPlugin.Debug("session opened") | ||||||
| 	Printf("rtsp session opened") |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // called after a session is closed. | func (conf *RTSPConfig) OnSessionClose(ctx *gortsplib.ServerHandlerOnSessionCloseCtx) { | ||||||
| func (sh *RTSPServer) OnSessionClose(ctx *gortsplib.ServerHandlerOnSessionCloseCtx) { | 	RTSPPlugin.Debug("session closed") | ||||||
| 	Printf("rtsp session closed") | 	if p, ok := conf.LoadAndDelete(ctx.Session); ok { | ||||||
| 	if v, ok := sh.LoadAndDelete(ctx.Session); ok { | 		p.(IIO).Stop() | ||||||
| 		switch v := v.(type) { |  | ||||||
| 		case *RTSPublisher: |  | ||||||
| 			v.Close() |  | ||||||
| 		case *RTSPSubscriber: |  | ||||||
| 			v.Close() |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| // called after receiving a DESCRIBE request. | // called after receiving a DESCRIBE request. | ||||||
| func (sh *RTSPServer) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (*base.Response, *gortsplib.ServerStream, error) { | func (conf *RTSPConfig) OnDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx) (*base.Response, *gortsplib.ServerStream, error) { | ||||||
| 	Printf("describe request") | 	RTSPPlugin.Debug("describe request") | ||||||
| 	var err error | 	var suber RTSPSubscriber | ||||||
| 	if s := engine.FindStream(ctx.Path); s != nil { | 	suber.SetIO(ctx.Conn.NetConn()) | ||||||
| 		var tracks gortsplib.Tracks | 	streamPath := ctx.Path | ||||||
| 		var stream *gortsplib.ServerStream | 	if ctx.Query != "" { | ||||||
| 		var sub RTSPSubscriber | 		streamPath = streamPath + "?" + ctx.Query | ||||||
| 		sub.Type = "RTSP pull" |  | ||||||
| 		sub.vt = s.WaitVideoTrack("h264", "h265") |  | ||||||
| 		sub.at = s.WaitAudioTrack("aac", "pcma", "pcmu") |  | ||||||
| 		ssrc := uintptr(unsafe.Pointer(stream)) |  | ||||||
| 		var trackIds = 0 |  | ||||||
| 		if sub.vt != nil { |  | ||||||
| 			trackId := trackIds |  | ||||||
| 			var vtrack *gortsplib.Track |  | ||||||
| 			var vpacketer rtp.Packetizer |  | ||||||
| 			switch sub.vt.CodecID { |  | ||||||
| 			case codec.CodecID_H264: |  | ||||||
| 				if vtrack, err = gortsplib.NewTrackH264(96, &gortsplib.TrackConfigH264{ |  | ||||||
| 					SPS: sub.vt.ExtraData.NALUs[0], |  | ||||||
| 					PPS: sub.vt.ExtraData.NALUs[1], |  | ||||||
| 				}); err == nil { |  | ||||||
| 					vpacketer = rtp.NewPacketizer(1200, 96, uint32(ssrc), &codecs.H264Payloader{}, rtp.NewFixedSequencer(1), 90000) |  | ||||||
| 				} else { |  | ||||||
| 					return nil, nil, err |  | ||||||
| 	} | 	} | ||||||
| 			case codec.CodecID_H265: | 	if err := RTSPPlugin.Subscribe(streamPath, &suber); err == nil { | ||||||
| 				vtrack = NewH265Track(96, sub.vt.ExtraData.NALUs) | 		RTSPPlugin.Debug("describe replay ok") | ||||||
| 				vpacketer = rtp.NewPacketizer(1200, 96, uint32(ssrc), &H265Payloader{}, rtp.NewFixedSequencer(1), 90000) | 		conf.Store(ctx.Conn, &suber) | ||||||
| 			} |  | ||||||
| 			var st uint32 |  | ||||||
| 			onVideo := func(ts uint32, pack *engine.VideoPack) { |  | ||||||
| 				for _, nalu := range pack.NALUs { |  | ||||||
| 					for _, pack := range vpacketer.Packetize(nalu, (ts-st)*90) { |  | ||||||
| 						rtp, _ := pack.Marshal() |  | ||||||
| 						stream.WritePacketRTP(trackId, rtp) |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 				st = ts |  | ||||||
| 			} |  | ||||||
| 			sub.OnVideo = func(ts uint32, pack *engine.VideoPack) { |  | ||||||
| 				if st = ts; st != 0 { |  | ||||||
| 					sub.OnVideo = onVideo |  | ||||||
| 				} |  | ||||||
| 				onVideo(ts, pack) |  | ||||||
| 			} |  | ||||||
| 			tracks = append(tracks, vtrack) |  | ||||||
| 			trackIds++ |  | ||||||
| 		} |  | ||||||
| 		if sub.at != nil { |  | ||||||
| 			var st uint32 |  | ||||||
| 			trackId := trackIds |  | ||||||
| 			switch sub.at.CodecID { |  | ||||||
| 			case codec.CodecID_PCMA, codec.CodecID_PCMU: |  | ||||||
| 				atrack := NewG711Track(97, map[byte]string{7: "pcma", 8: "pcmu"}[sub.at.CodecID]) |  | ||||||
| 				apacketizer := rtp.NewPacketizer(1200, 97, uint32(ssrc), &codecs.G711Payloader{}, rtp.NewFixedSequencer(1), 8000) |  | ||||||
| 				sub.OnAudio = func(ts uint32, pack *engine.AudioPack) { |  | ||||||
| 					for _, pack := range apacketizer.Packetize(pack.Raw, (ts-st)*8) { |  | ||||||
| 						buf, _ := pack.Marshal() |  | ||||||
| 						stream.WritePacketRTP(trackId, buf) |  | ||||||
| 					} |  | ||||||
| 					st = ts |  | ||||||
| 				} |  | ||||||
| 				tracks = append(tracks, atrack) |  | ||||||
| 			case codec.CodecID_AAC: |  | ||||||
| 				var mpegConf aac.MPEG4AudioConfig |  | ||||||
| 				mpegConf.Decode(sub.at.ExtraData[2:]) |  | ||||||
| 				conf := &gortsplib.TrackConfigAAC{ |  | ||||||
| 					Type:              int(mpegConf.Type), |  | ||||||
| 					SampleRate:        mpegConf.SampleRate, |  | ||||||
| 					ChannelCount:      mpegConf.ChannelCount, |  | ||||||
| 					AOTSpecificConfig: mpegConf.AOTSpecificConfig, |  | ||||||
| 				} |  | ||||||
| 				if atrack, err := gortsplib.NewTrackAAC(97, conf); err == nil { |  | ||||||
| 					apacketizer := rtp.NewPacketizer(1200, 97, uint32(ssrc), &AACPayloader{}, rtp.NewFixedSequencer(1), uint32(mpegConf.SampleRate)) |  | ||||||
| 					sub.OnAudio = func(ts uint32, pack *engine.AudioPack) { |  | ||||||
| 						for _, pack := range apacketizer.Packetize(pack.Raw, (ts-st)*uint32(mpegConf.SampleRate)/1000) { |  | ||||||
| 							buf, _ := pack.Marshal() |  | ||||||
| 							stream.WritePacketRTP(trackId, buf) |  | ||||||
| 						} |  | ||||||
| 						st = ts |  | ||||||
| 					} |  | ||||||
| 					tracks = append(tracks, atrack) |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 		stream = gortsplib.NewServerStream(tracks) |  | ||||||
| 		sub.stream = stream |  | ||||||
| 		sh.Store(ctx.Conn, &sub) |  | ||||||
| 		return &base.Response{ | 		return &base.Response{ | ||||||
| 			StatusCode: base.StatusOK, | 			StatusCode: base.StatusOK, | ||||||
| 		}, stream, nil | 		}, suber.stream, nil | ||||||
| 		// if stream, ok := s.ExtraProp.(*gortsplib.ServerStream); ok { | 	} else { | ||||||
| 		// 	return &base.Response{ |  | ||||||
| 		// 		StatusCode: base.StatusOK, |  | ||||||
| 		// 	}, stream, nil |  | ||||||
| 		// } |  | ||||||
| 	} |  | ||||||
| 		return &base.Response{ | 		return &base.Response{ | ||||||
| 			StatusCode: base.StatusNotFound, | 			StatusCode: base.StatusNotFound, | ||||||
| 	}, nil, nil | 		}, suber.stream, nil | ||||||
|  | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| // called after receiving an ANNOUNCE request. | func (conf *RTSPConfig) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) { | ||||||
| func (sh *RTSPServer) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (*base.Response, error) { | 	var resp base.Response | ||||||
| 	Printf("announce request") | 	resp.StatusCode = base.StatusOK | ||||||
| 	p := &RTSPublisher{ | 	if p, ok := conf.Load(ctx.Conn); ok { | ||||||
| 		Stream: &engine.Stream{ | 		switch v := p.(type) { | ||||||
| 			StreamPath: ctx.Path, | 		case *RTSPSubscriber: | ||||||
| 			Type:       "RTSP push", | 			return &resp, v.stream, nil | ||||||
| 		}, | 		case *RTSPPublisher: | ||||||
|  | 			return &resp, v.stream, nil | ||||||
| 		} | 		} | ||||||
| 	p.ExtraProp = p | 	} | ||||||
| 	p.URL = ctx.Req.URL.String() | 	resp.StatusCode = base.StatusNotFound | ||||||
| 	if p.Publish() { | 	return &resp, nil, nil | ||||||
| 		p.setTracks(ctx.Tracks) | } | ||||||
| 		p.stream = gortsplib.NewServerStream(ctx.Tracks) |  | ||||||
| 		sh.Store(ctx.Conn, p) | func (conf *RTSPConfig) OnPlay(ctx *gortsplib.ServerHandlerOnPlayCtx) (*base.Response, error) { | ||||||
| 		sh.Store(ctx.Session, p) | 	var resp base.Response | ||||||
|  | 	resp.StatusCode = base.StatusNotFound | ||||||
|  | 	if p, ok := conf.Load(ctx.Conn); ok { | ||||||
|  | 		switch v := p.(type) { | ||||||
|  | 		case *RTSPSubscriber: | ||||||
|  | 			resp.StatusCode = base.StatusOK | ||||||
|  | 			go func() { | ||||||
|  | 				v.PlayRTP() | ||||||
|  | 				ctx.Session.Close() | ||||||
|  | 			}() | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return &resp, nil | ||||||
|  | } | ||||||
|  | func (conf *RTSPConfig) OnRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*base.Response, error) { | ||||||
|  | 	if p, ok := conf.Load(ctx.Session); ok { | ||||||
|  | 		ctx.Session.OnPacketRTPAny(p.(*RTSPPublisher).OnPacket) | ||||||
|  | 	} | ||||||
|  | 	return &base.Response{ | ||||||
|  | 		StatusCode: base.StatusOK, | ||||||
|  | 	}, nil | ||||||
|  | } | ||||||
|  | func (conf *RTSPConfig) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (*base.Response, error) { | ||||||
|  | 	p := &RTSPPublisher{} | ||||||
|  | 	p.SetIO(ctx.Conn.NetConn()) | ||||||
|  | 	if err := RTSPPlugin.Publish(ctx.Path, p); err == nil { | ||||||
|  | 		p.tracks = ctx.Medias | ||||||
|  | 		p.stream = gortsplib.NewServerStream(ctx.Medias) | ||||||
|  | 		if err = p.SetTracks(); err != nil { | ||||||
|  | 			return nil, err | ||||||
|  | 		} | ||||||
|  | 		conf.Store(ctx.Conn, p) | ||||||
|  | 		conf.Store(ctx.Session, p) | ||||||
| 	} else { | 	} else { | ||||||
| 		return &base.Response{ | 		return &base.Response{ | ||||||
| 			StatusCode: base.StatusBadRequest, | 			StatusCode: base.StatusBadRequest, | ||||||
| 		}, fmt.Errorf("streamPath is already exist") | 		}, nil | ||||||
| 	} | 	} | ||||||
| 	return &base.Response{ | 	return &base.Response{ | ||||||
| 		StatusCode: base.StatusOK, | 		StatusCode: base.StatusOK, | ||||||
| 	}, nil | 	}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
| // called after receiving a SETUP request. |  | ||||||
| func (sh *RTSPServer) OnSetup(ctx *gortsplib.ServerHandlerOnSetupCtx) (*base.Response, *gortsplib.ServerStream, error) { |  | ||||||
| 	Printf("setup request") |  | ||||||
| 	if p, ok := sh.Load(ctx.Conn); ok { |  | ||||||
| 		switch v := p.(type) { |  | ||||||
| 		case *RTSPublisher: |  | ||||||
| 			return &base.Response{ |  | ||||||
| 				StatusCode: base.StatusOK, |  | ||||||
| 			}, v.stream, nil |  | ||||||
| 		case *RTSPSubscriber: |  | ||||||
| 			return &base.Response{ |  | ||||||
| 				StatusCode: base.StatusOK, |  | ||||||
| 			}, v.stream, nil |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	return &base.Response{ |  | ||||||
| 		StatusCode: base.StatusNotFound, |  | ||||||
| 	}, nil, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // called after receiving a PLAY request. |  | ||||||
| func (sh *RTSPServer) OnPlay(ctx *gortsplib.ServerHandlerOnPlayCtx) (*base.Response, error) { |  | ||||||
| 	Printf("play request") |  | ||||||
| 	if p, ok := sh.Load(ctx.Conn); ok { |  | ||||||
| 		if sub := p.(*RTSPSubscriber); sub.Subscribe(ctx.Path) == nil { |  | ||||||
| 			go func() { |  | ||||||
| 				sub.Play(sub.at, sub.vt) |  | ||||||
| 				ctx.Conn.Close() |  | ||||||
| 			}() |  | ||||||
| 			return &base.Response{ |  | ||||||
| 				StatusCode: base.StatusOK, |  | ||||||
| 			}, nil |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	return &base.Response{ |  | ||||||
| 		StatusCode: base.StatusNotFound, |  | ||||||
| 	}, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // called after receiving a RECORD request. |  | ||||||
| func (sh *RTSPServer) OnRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*base.Response, error) { |  | ||||||
| 	Printf("record request") |  | ||||||
| 	return &base.Response{ |  | ||||||
| 		StatusCode: base.StatusOK, |  | ||||||
| 	}, nil |  | ||||||
| } |  | ||||||
|  |  | ||||||
| // called after receiving a frame. |  | ||||||
| func (sh *RTSPServer) OnPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx) { |  | ||||||
| 	if p, ok := sh.Load(ctx.Session); ok { |  | ||||||
| 		rtsp := p.(*RTSPublisher) |  | ||||||
| 		if rtsp.Err() != nil { |  | ||||||
| 			ctx.Session.Close() |  | ||||||
| 			return |  | ||||||
| 		} |  | ||||||
| 		if f := rtsp.processFunc[ctx.TrackID]; f != nil { |  | ||||||
| 			f(ctx.Payload) |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|   | |||||||
							
								
								
									
										100
									
								
								subscriber.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								subscriber.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,100 @@ | |||||||
|  | package rtsp | ||||||
|  |  | ||||||
|  | import ( | ||||||
|  | 	"github.com/aler9/gortsplib/v2" | ||||||
|  | 	"github.com/aler9/gortsplib/v2/pkg/codecs/mpeg4audio" | ||||||
|  | 	"github.com/aler9/gortsplib/v2/pkg/format" | ||||||
|  | 	"github.com/aler9/gortsplib/v2/pkg/media" | ||||||
|  | 	. "m7s.live/engine/v4" | ||||||
|  | 	"m7s.live/engine/v4/codec" | ||||||
|  | 	"m7s.live/engine/v4/track" | ||||||
|  | ) | ||||||
|  |  | ||||||
|  | type RTSPSubscriber struct { | ||||||
|  | 	Subscriber | ||||||
|  | 	RTSPIO | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func (s *RTSPSubscriber) OnEvent(event any) { | ||||||
|  | 	switch v := event.(type) { | ||||||
|  | 	case *track.Video: | ||||||
|  | 		if s.Video != nil { | ||||||
|  | 			return | ||||||
|  | 		} | ||||||
|  | 		switch v.CodecID { | ||||||
|  | 		case codec.CodecID_H264: | ||||||
|  | 			video := &media.Media{ | ||||||
|  | 				Type: media.TypeVideo, | ||||||
|  | 				Formats: []format.Format{&format.H264{ | ||||||
|  | 					PacketizationMode: 1, | ||||||
|  | 					PayloadTyp:        v.PayloadType, | ||||||
|  | 					SPS:               v.ParamaterSets[0], | ||||||
|  | 					PPS:               v.ParamaterSets[1], | ||||||
|  | 				}}, | ||||||
|  | 			} | ||||||
|  | 			s.videoTrack = video | ||||||
|  | 			s.tracks = append(s.tracks, video) | ||||||
|  | 		case codec.CodecID_H265: | ||||||
|  | 			video := &media.Media{ | ||||||
|  | 				Type: media.TypeVideo, | ||||||
|  | 				Formats: []format.Format{&format.H265{ | ||||||
|  | 					PayloadTyp: v.PayloadType, | ||||||
|  | 					VPS:        v.ParamaterSets[0], | ||||||
|  | 					SPS:        v.ParamaterSets[1], | ||||||
|  | 					PPS:        v.ParamaterSets[2], | ||||||
|  | 				}}, | ||||||
|  | 			} | ||||||
|  | 			s.videoTrack = video | ||||||
|  | 			s.tracks = append(s.tracks, video) | ||||||
|  | 		} | ||||||
|  | 		s.AddTrack(v) | ||||||
|  | 	case *track.Audio: | ||||||
|  | 		if s.Audio != nil { | ||||||
|  | 			return | ||||||
|  | 		} | ||||||
|  | 		switch v.CodecID { | ||||||
|  | 		case codec.CodecID_AAC: | ||||||
|  | 			audio := &media.Media{ | ||||||
|  | 				Type: media.TypeAudio, | ||||||
|  | 				Formats: []format.Format{&format.MPEG4Audio{ | ||||||
|  | 					PayloadTyp: v.PayloadType, | ||||||
|  | 					Config: &mpeg4audio.Config{ | ||||||
|  | 						Type:         mpeg4audio.ObjectTypeAACLC, | ||||||
|  | 						SampleRate:   int(v.SampleRate), | ||||||
|  | 						ChannelCount: int(v.Channels), | ||||||
|  | 					}, | ||||||
|  | 					SizeLength:       v.SizeLength, | ||||||
|  | 					IndexLength:      v.IndexLength, | ||||||
|  | 					IndexDeltaLength: v.IndexDeltaLength, | ||||||
|  | 				}}, | ||||||
|  | 			} | ||||||
|  | 			s.audioTrack = audio | ||||||
|  | 			s.tracks = append(s.tracks, audio) | ||||||
|  | 		case codec.CodecID_PCMA: | ||||||
|  | 			audio := &media.Media{ | ||||||
|  | 				Type:    media.TypeAudio, | ||||||
|  | 				Formats: []format.Format{&format.G711{}}, | ||||||
|  | 			} | ||||||
|  | 			s.audioTrack = audio | ||||||
|  | 			s.tracks = append(s.tracks, audio) | ||||||
|  | 		case codec.CodecID_PCMU: | ||||||
|  | 			audio := &media.Media{ | ||||||
|  | 				Type: media.TypeAudio, | ||||||
|  | 				Formats: []format.Format{&format.G711{ | ||||||
|  | 					MULaw: true, | ||||||
|  | 				}}, | ||||||
|  | 			} | ||||||
|  | 			s.audioTrack = audio | ||||||
|  | 			s.tracks = append(s.tracks, audio) | ||||||
|  | 		} | ||||||
|  | 		s.AddTrack(v) | ||||||
|  | 	case ISubscriber: | ||||||
|  | 		s.stream = gortsplib.NewServerStream(s.tracks) | ||||||
|  | 	case VideoRTP: | ||||||
|  | 		s.stream.WritePacketRTP(s.videoTrack, v.Packet) | ||||||
|  | 	case AudioRTP: | ||||||
|  | 		s.stream.WritePacketRTP(s.audioTrack, v.Packet) | ||||||
|  | 	default: | ||||||
|  | 		s.Subscriber.OnEvent(event) | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										87
									
								
								track.go
									
									
									
									
									
								
							
							
						
						
									
										87
									
								
								track.go
									
									
									
									
									
								
							| @@ -1,87 +0,0 @@ | |||||||
| package rtsp |  | ||||||
|  |  | ||||||
| import ( |  | ||||||
| 	"encoding/base64" |  | ||||||
| 	"fmt" |  | ||||||
| 	"strconv" |  | ||||||
|  |  | ||||||
| 	"github.com/aler9/gortsplib" |  | ||||||
| 	psdp "github.com/pion/sdp/v3" |  | ||||||
| ) |  | ||||||
|  |  | ||||||
| // func NewTrackAAC(payloadType uint8, conf *gortsplib.TrackConfigAAC) (*gortsplib.Track, error) { |  | ||||||
| // 	mpegConf, err := aac.MPEG4AudioConfig{ |  | ||||||
| // 		Type:              aac.MPEG4AudioType(conf.Type), |  | ||||||
| // 		SampleRate:        conf.SampleRate, |  | ||||||
| // 		ChannelCount:      conf.ChannelCount, |  | ||||||
| // 		AOTSpecificConfig: conf.AOTSpecificConfig, |  | ||||||
| // 	}.Encode() |  | ||||||
| // 	if err != nil { |  | ||||||
| // 		return nil, err |  | ||||||
| // 	} |  | ||||||
|  |  | ||||||
| // 	typ := strconv.FormatInt(int64(payloadType), 10) |  | ||||||
|  |  | ||||||
| // 	return &gortsplib.Track{ |  | ||||||
| // 		Media: &psdp.MediaDescription{ |  | ||||||
| // 			MediaName: psdp.MediaName{ |  | ||||||
| // 				Media:   "audio", |  | ||||||
| // 				Protos:  []string{"RTP", "AVP"}, |  | ||||||
| // 				Formats: []string{typ}, |  | ||||||
| // 			}, |  | ||||||
| // 			Attributes: []psdp.Attribute{ |  | ||||||
| // 				{ |  | ||||||
| // 					Key: "rtpmap", |  | ||||||
| // 					Value: typ + " mpeg4-generic/" + strconv.FormatInt(int64(conf.SampleRate), 10) + |  | ||||||
| // 						"/" + strconv.FormatInt(int64(conf.ChannelCount), 10), |  | ||||||
| // 				}, |  | ||||||
| // 				{ |  | ||||||
| // 					Key: "fmtp", |  | ||||||
| // 					Value: typ + " profile-level-id=1; " + |  | ||||||
| // 						"mode=AAC-hbr; " + |  | ||||||
| // 						"sizelength=6; " + |  | ||||||
| // 						"indexlength=2; " + |  | ||||||
| // 						"indexdeltalength=2; " + |  | ||||||
| // 						"config=" + hex.EncodeToString(mpegConf), |  | ||||||
| // 				}, |  | ||||||
| // 			}, |  | ||||||
| // 		}, |  | ||||||
| // 	}, nil |  | ||||||
| // } |  | ||||||
| func NewG711Track(payloadType uint8, law string) *gortsplib.Track { |  | ||||||
| 	return &gortsplib.Track{ |  | ||||||
| 		Media: &psdp.MediaDescription{ |  | ||||||
| 			MediaName: psdp.MediaName{ |  | ||||||
| 				Media:   "audio", |  | ||||||
| 				Protos:  []string{"RTP", "AVP"}, |  | ||||||
| 				Formats: []string{strconv.FormatInt(int64(payloadType), 10)}}, |  | ||||||
| 			Attributes: []psdp.Attribute{ |  | ||||||
| 				{ |  | ||||||
| 					Key:   "rtpmap", |  | ||||||
| 					Value: fmt.Sprintf("%d %s/8000/1", payloadType, law), |  | ||||||
| 				}, |  | ||||||
| 			}, |  | ||||||
| 		}, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| func NewH265Track(payloadType uint8, sprop [][]byte) *gortsplib.Track { |  | ||||||
| 	return &gortsplib.Track{ |  | ||||||
| 		Media: &psdp.MediaDescription{ |  | ||||||
| 			MediaName: psdp.MediaName{ |  | ||||||
| 				Media:   "video", |  | ||||||
| 				Protos:  []string{"RTP", "AVP"}, |  | ||||||
| 				Formats: []string{fmt.Sprintf("%d", payloadType)}, |  | ||||||
| 			}, |  | ||||||
| 			Attributes: []psdp.Attribute{ |  | ||||||
| 				{ |  | ||||||
| 					Key:   "rtpmap", |  | ||||||
| 					Value: fmt.Sprintf("%d H265/90000", payloadType), |  | ||||||
| 				}, |  | ||||||
| 				{ |  | ||||||
| 					Key:   "fmtp", |  | ||||||
| 					Value: fmt.Sprintf("%d packetization-mode=1;sprop-vps=%s;sprop-sps=%s;sprop-pps=%s;", payloadType, base64.StdEncoding.EncodeToString(sprop[0]), base64.StdEncoding.EncodeToString(sprop[1]), base64.StdEncoding.EncodeToString(sprop[2])), |  | ||||||
| 				}, |  | ||||||
| 			}, |  | ||||||
| 		}, |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
		Reference in New Issue
	
	Block a user