mirror of
				https://github.com/Monibuca/plugin-rtsp.git
				synced 2025-10-31 19:03:05 +08:00 
			
		
		
		
	Compare commits
	
		
			12 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 1ad45bfbc1 | ||
|   | a4773b4044 | ||
|   | 225bb482d5 | ||
|   | ea5ea6f48a | ||
|   | beda2dd9e0 | ||
|   | 344ab6f463 | ||
|   | d5e73d11db | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 12350b8af0 | ||
|   | 3b671606b6 | ||
|   | 70321ccd1f | ||
|   | 5ddbd7a852 | ||
|   | f32f44db40 | 
							
								
								
									
										70
									
								
								README.en.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								README.en.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,70 @@ | |||||||
|  | _[简体中文](https://github.com/Monibuca/plugin-rtsp/README.md) | English_ | ||||||
|  | # RTSP Plugin | ||||||
|  |  | ||||||
|  | The RTSP plugin provides the ability to push and pull the RTSP protocol and also to push and pull the RTSP protocol to remote servers. | ||||||
|  |  | ||||||
|  | ## Plugin address | ||||||
|  |  | ||||||
|  | https://github.com/Monibuca/plugin-rtsp | ||||||
|  |  | ||||||
|  | ## Plugin introduction | ||||||
|  |  | ||||||
|  | ```go | ||||||
|  | import ( | ||||||
|  |     _ "m7s.live/plugin/rtsp/v4" | ||||||
|  | ) | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | ## Push and Pull address form | ||||||
|  |  | ||||||
|  | ``` | ||||||
|  | rtsp://localhost/live/test | ||||||
|  | ``` | ||||||
|  | - `localhost` is the m7s server domain name or IP address, and the default port `554` can be omitted, otherwise it is required to be written. | ||||||
|  | - `live` represents `appName` | ||||||
|  | - `test` represents `streamName` | ||||||
|  | - `live/test` in m7s will serve as the stream identity. | ||||||
|  |  | ||||||
|  | For example, push stream to m7s through ffmpeg | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | ffmpeg -i [video source] -c:v h264 -c:a aac -f rtsp rtsp://localhost/live/test | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | This will create a stream named `live/test` inside m7s. | ||||||
|  |  | ||||||
|  | If the `live/test` stream already exists in m7s, then you can use the RTSP protocol to play it. | ||||||
|  |  | ||||||
|  | ```bash | ||||||
|  | ffplay rtsp://localhost/live/test | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | ## Configuration | ||||||
|  |  | ||||||
|  | ```yaml | ||||||
|  | rtsp: | ||||||
|  |     publish: # Refer to the global configuration format | ||||||
|  |     subscribe: # Refer to the global configuration format | ||||||
|  |     pull: # Format reference document https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE | ||||||
|  |     push: # Format reference document https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE | ||||||
|  |     listenaddr: :554 | ||||||
|  |     udpaddr: :8000 | ||||||
|  |     rtcpaddr: :8001 | ||||||
|  |     readbuffercount: 2048 | ||||||
|  |     writebuffercount: 2048 | ||||||
|  |     pullprotocol: 'auto' # auto, tcp, udp | ||||||
|  | ``` | ||||||
|  | :::tip Configuration override | ||||||
|  | publish and subscribe, any section not configured will use global configuration. | ||||||
|  | ::: | ||||||
|  |  | ||||||
|  | ## API | ||||||
|  |  | ||||||
|  | ### `rtsp/api/list` | ||||||
|  | Get all RTSP streams | ||||||
|  |  | ||||||
|  | ### `rtsp/api/pull?target=[RTSP address]&streamPath=[Stream identity]` | ||||||
|  | Pull the RTSP to m7s from a remote server | ||||||
|  |  | ||||||
|  | ### `rtsp/api/push?target=[RTSP address]&streamPath=[Stream identity]` | ||||||
|  | Push local streams to remote servers | ||||||
							
								
								
									
										33
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,3 +1,4 @@ | |||||||
|  | _[English](https://github.com/Monibuca/plugin-rtsp/README.en.md) | 简体中文_ | ||||||
| # RTSP插件 | # RTSP插件 | ||||||
| rtsp插件提供rtsp协议的推拉流能力,以及向远程服务器推拉rtsp协议的能力。 | rtsp插件提供rtsp协议的推拉流能力,以及向远程服务器推拉rtsp协议的能力。 | ||||||
| ## 插件地址 | ## 插件地址 | ||||||
| @@ -24,7 +25,7 @@ rtsp://localhost/live/test | |||||||
| 例如通过ffmpeg向m7s进行推流 | 例如通过ffmpeg向m7s进行推流 | ||||||
|  |  | ||||||
| ```bash | ```bash | ||||||
| ffmpeg -i [视频源] -c:v h264 -f rtsp rtsp://localhost/live/test | ffmpeg -i [视频源] -c:v h264 -c:a aac -f rtsp rtsp://localhost/live/test | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| 会在m7s内部形成一个名为live/test的流 | 会在m7s内部形成一个名为live/test的流 | ||||||
| @@ -35,34 +36,20 @@ ffmpeg -i [视频源] -c:v h264 -f rtsp rtsp://localhost/live/test | |||||||
| ffplay rtsp://localhost/live/test | ffplay rtsp://localhost/live/test | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  |  | ||||||
| ## 配置 | ## 配置 | ||||||
|  |  | ||||||
| ```yaml | ```yaml | ||||||
| rtsp: | rtsp: | ||||||
|     publish: |     publish: # 参考全局配置格式 | ||||||
|         pubaudio: true |     subscribe: # 参考全局配置格式 | ||||||
|         pubvideo: true |     pull: # 格式参考文档 https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE | ||||||
|         kickexist: false |     push: # 格式参考文档 https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE | ||||||
|         publishtimeout: 10 |  | ||||||
|         waitclosetimeout: 0 |  | ||||||
|     subscribe: |  | ||||||
|         subaudio: true |  | ||||||
|         subvideo: true |  | ||||||
|         iframeonly: false |  | ||||||
|         waittimeout: 10 |  | ||||||
|     pull: |  | ||||||
|         repull: 0 |  | ||||||
|         pullonstart: {} |  | ||||||
|         pullonsub: {} |  | ||||||
|     push: |  | ||||||
|         repush: 0 |  | ||||||
|         pushlist: {} |  | ||||||
|     listenaddr: :554 |     listenaddr: :554 | ||||||
|     udpaddr: :8000 |     udpaddr: :8000 | ||||||
|     rtcpaddr: :8001 |     rtcpaddr: :8001 | ||||||
|     readbuffersize: 2048 |     readbuffercount: 2048 # 读取缓存队列大小 | ||||||
|     pullprotocol: 'auto' |     writebuffercount: 2048 # 写出缓存队列大小 | ||||||
|  |     pullprotocol: 'auto' # auto, tcp, udp | ||||||
| ``` | ``` | ||||||
| :::tip 配置覆盖 | :::tip 配置覆盖 | ||||||
| publish | publish | ||||||
| @@ -74,7 +61,7 @@ subscribe | |||||||
| ### `rtsp/api/list` | ### `rtsp/api/list` | ||||||
| 获取所有rtsp流 | 获取所有rtsp流 | ||||||
|  |  | ||||||
| ### `rtsp/api/pull?target=[RTSP地址]&streamPath=[流标识]` | ### `rtsp/api/pull?target=[RTSP地址]&streamPath=[流标识]&save=[0|1]` | ||||||
| 从远程拉取rtsp到m7s中 | 从远程拉取rtsp到m7s中 | ||||||
|  |  | ||||||
| ### `rtsp/api/push?target=[RTSP地址]&streamPath=[流标识]` | ### `rtsp/api/push?target=[RTSP地址]&streamPath=[流标识]` | ||||||
|   | |||||||
							
								
								
									
										73
									
								
								client.go
									
									
									
									
									
								
							
							
						
						
									
										73
									
								
								client.go
									
									
									
									
									
								
							| @@ -1,40 +1,39 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/aler9/gortsplib" | 	"context" | ||||||
| 	"github.com/aler9/gortsplib/pkg/url" | 	"net" | ||||||
|  |  | ||||||
|  | 	"github.com/bluenviron/gortsplib/v3" | ||||||
|  | 	"github.com/bluenviron/gortsplib/v3/pkg/url" | ||||||
| 	"go.uber.org/zap" | 	"go.uber.org/zap" | ||||||
| 	"m7s.live/engine/v4" | 	"m7s.live/engine/v4" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | type RTSPClient struct { | ||||||
|  | 	*gortsplib.Client `json:"-" yaml:"-"` | ||||||
|  | 	gortsplib.Transport | ||||||
|  | 	DialContext func(ctx context.Context, network, address string) (net.Conn, error) `json:"-" yaml:"-"` | ||||||
|  | } | ||||||
| type RTSPPuller struct { | type RTSPPuller struct { | ||||||
| 	RTSPPublisher | 	RTSPPublisher | ||||||
| 	engine.Puller | 	engine.Puller | ||||||
| 	*gortsplib.Client `json:"-"` | 	RTSPClient | ||||||
| 	gortsplib.Transport |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (p *RTSPPuller) Connect() error { | func (p *RTSPPuller) Connect() error { | ||||||
|  | 	p.Client = &gortsplib.Client{ | ||||||
|  | 		DialContext:     p.DialContext, | ||||||
|  | 		ReadBufferCount: rtspConfig.ReadBufferCount, | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	switch rtspConfig.PullProtocol { | 	switch rtspConfig.PullProtocol { | ||||||
| 	case "tcp", "TCP": | 	case "tcp", "TCP": | ||||||
| 		p.Transport = gortsplib.TransportTCP | 		p.Transport = gortsplib.TransportTCP | ||||||
|  | 		p.Client.Transport = &p.Transport | ||||||
| 	case "udp", "UDP": | 	case "udp", "UDP": | ||||||
| 		p.Transport = gortsplib.TransportUDP | 		p.Transport = gortsplib.TransportUDP | ||||||
| 	default: | 		p.Client.Transport = &p.Transport | ||||||
| 		if p.Transport == gortsplib.TransportTCP { |  | ||||||
| 			p.Transport = gortsplib.TransportUDP |  | ||||||
| 		} else { |  | ||||||
| 			p.Transport = gortsplib.TransportTCP |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	p.Client = &gortsplib.Client{ |  | ||||||
| 		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, |  | ||||||
| 	} | 	} | ||||||
| 	// parse URL | 	// parse URL | ||||||
| 	u, err := url.Parse(p.RemoteURL) | 	u, err := url.Parse(p.RemoteURL) | ||||||
| @@ -63,40 +62,44 @@ func (p *RTSPPuller) Pull() (err error) { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	p.tracks = tracks | 	p.tracks = tracks | ||||||
| 	p.SetTracks() | 	err = p.SetTracks() | ||||||
| 	if err = p.SetupAndPlay(tracks, baseURL); err != nil { | 	if err != nil { | ||||||
|  | 		p.Error("SetTracks", zap.Error(err)) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	if err = p.SetupAll(tracks, baseURL); err != nil { | ||||||
| 		p.Error("SetupAndPlay", zap.Error(err)) | 		p.Error("SetupAndPlay", zap.Error(err)) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
|  | 	p.OnPacketRTPAny(p.OnPacket) | ||||||
|  | 	_, err = p.Play(nil) | ||||||
|  | 	if err != nil { | ||||||
|  | 		p.Error("Play", zap.Error(err)) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
| 	return p.Wait() | 	return p.Wait() | ||||||
| } | } | ||||||
|  |  | ||||||
| type RTSPPusher struct { | type RTSPPusher struct { | ||||||
| 	RTSPSubscriber | 	RTSPSubscriber | ||||||
| 	engine.Pusher | 	engine.Pusher | ||||||
| 	*gortsplib.Client | 	RTSPClient | ||||||
| 	gortsplib.Transport |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (p *RTSPPusher) OnEvent(event any) { | func (p *RTSPPusher) OnEvent(event any) { | ||||||
| 	switch v := event.(type) { | 	switch v := event.(type) { | ||||||
| 	case engine.VideoRTP: | 	case engine.VideoRTP: | ||||||
| 		p.Client.WritePacketRTP(p.videoTrackId, &v.Packet) | 		p.Client.WritePacketRTP(p.videoTrack, v.Packet) | ||||||
| 	case engine.AudioRTP: | 	case engine.AudioRTP: | ||||||
| 		p.Client.WritePacketRTP(p.audioTrackId, &v.Packet) | 		p.Client.WritePacketRTP(p.audioTrack, v.Packet) | ||||||
| 	default: | 	default: | ||||||
| 		p.RTSPSubscriber.OnEvent(event) | 		p.RTSPSubscriber.OnEvent(event) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| func (p *RTSPPusher) Connect() error { | func (p *RTSPPusher) Connect() error { | ||||||
| 	if p.Transport == gortsplib.TransportTCP { |  | ||||||
| 		p.Transport = gortsplib.TransportUDP |  | ||||||
| 	} else { |  | ||||||
| 		p.Transport = gortsplib.TransportTCP |  | ||||||
| 	} |  | ||||||
| 	p.Client = &gortsplib.Client{ | 	p.Client = &gortsplib.Client{ | ||||||
| 		ReadBufferCount: rtspConfig.ReadBufferSize, | 		DialContext:      p.DialContext, | ||||||
| 		Transport:       &p.Transport, | 		WriteBufferCount: rtspConfig.WriteBufferCount, | ||||||
| 	} | 	} | ||||||
| 	// parse URL | 	// parse URL | ||||||
| 	u, err := url.Parse(p.RemoteURL) | 	u, err := url.Parse(p.RemoteURL) | ||||||
| @@ -116,7 +119,6 @@ func (p *RTSPPusher) Connect() error { | |||||||
| func (p *RTSPPusher) Push() (err error) { | func (p *RTSPPusher) Push() (err error) { | ||||||
| 	var u *url.URL | 	var u *url.URL | ||||||
| 	u, err = url.Parse(p.RemoteURL) | 	u, err = url.Parse(p.RemoteURL) | ||||||
| 	defer p.Stop() |  | ||||||
| 	// startTime := time.Now() | 	// startTime := time.Now() | ||||||
| 	// for len(p.tracks) < 2 { | 	// for len(p.tracks) < 2 { | ||||||
| 	// 	if time.Sleep(time.Second); time.Since(startTime) > time.Second*10 { | 	// 	if time.Sleep(time.Second); time.Since(startTime) > time.Second*10 { | ||||||
| @@ -127,13 +129,12 @@ func (p *RTSPPusher) Push() (err error) { | |||||||
| 		p.Error("Announce", zap.Error(err)) | 		p.Error("Announce", zap.Error(err)) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	for _, track := range p.tracks { | 	err = p.SetupAll(p.tracks, u) | ||||||
| 		_, err = p.Setup(track, u, 0, 0) |  | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		p.Error("Setup", zap.Error(err)) | 		p.Error("Setup", zap.Error(err)) | ||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
| 	if _, err = p.Record(); err != nil { | 	if _, err = p.Record(); err != nil { | ||||||
| 		p.Error("Record", zap.Error(err)) | 		p.Error("Record", zap.Error(err)) | ||||||
| 		return | 		return | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								go.mod
									
									
									
									
									
								
							| @@ -3,44 +3,50 @@ module m7s.live/plugin/rtsp/v4 | |||||||
| go 1.18 | go 1.18 | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
| 	github.com/aler9/gortsplib v0.0.0-20221115222755-87d5a512b129 | 	github.com/bluenviron/gortsplib/v3 v3.2.1 | ||||||
|  | 	github.com/bluenviron/mediacommon v0.2.1 | ||||||
|  | 	github.com/pion/rtp v1.7.13 | ||||||
| 	go.uber.org/zap v1.23.0 | 	go.uber.org/zap v1.23.0 | ||||||
| 	m7s.live/engine/v4 v4.10.0 | 	m7s.live/engine/v4 v4.11.18 | ||||||
| ) | ) | ||||||
|  |  | ||||||
| require ( | require ( | ||||||
|  | 	github.com/aler9/gortsplib v1.0.1 // indirect | ||||||
|  | 	github.com/aler9/gortsplib/v2 v2.2.2 // indirect | ||||||
| 	github.com/cnotch/ipchub v1.1.0 // indirect | 	github.com/cnotch/ipchub v1.1.0 // indirect | ||||||
|  | 	github.com/denisbrodbeck/machineid v1.0.1 // indirect | ||||||
| 	github.com/go-ole/go-ole v1.2.6 // 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/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect | ||||||
| 	github.com/golang/mock v1.6.0 // indirect | 	github.com/golang/mock v1.6.0 // indirect | ||||||
| 	github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect | 	github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect | ||||||
| 	github.com/google/uuid v1.3.0 // 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/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/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c // indirect | ||||||
| 	github.com/marten-seemann/qtls-go1-18 v0.1.3 // indirect | 	github.com/mcuadros/go-defaults v1.2.0 // indirect | ||||||
| 	github.com/marten-seemann/qtls-go1-19 v0.1.1 // indirect |  | ||||||
| 	github.com/onsi/ginkgo/v2 v2.2.0 // indirect | 	github.com/onsi/ginkgo/v2 v2.2.0 // indirect | ||||||
| 	github.com/pion/randutil v0.1.0 // indirect | 	github.com/pion/randutil v0.1.0 // indirect | ||||||
| 	github.com/pion/rtcp v1.2.10 // indirect | 	github.com/pion/rtcp v1.2.10 // indirect | ||||||
| 	github.com/pion/rtp v1.7.13 // indirect |  | ||||||
| 	github.com/pion/sdp/v3 v3.0.6 // indirect | 	github.com/pion/sdp/v3 v3.0.6 // indirect | ||||||
| 	github.com/pion/webrtc/v3 v3.1.49 // indirect | 	github.com/pion/webrtc/v3 v3.1.49 // indirect | ||||||
| 	github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect | 	github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect | ||||||
| 	github.com/q191201771/naza v0.30.8 // indirect | 	github.com/q191201771/naza v0.30.8 // indirect | ||||||
|  | 	github.com/quic-go/qtls-go1-18 v0.2.0 // indirect | ||||||
|  | 	github.com/quic-go/qtls-go1-19 v0.2.0 // indirect | ||||||
|  | 	github.com/quic-go/qtls-go1-20 v0.1.0 // indirect | ||||||
|  | 	github.com/quic-go/quic-go v0.32.0 // indirect | ||||||
| 	github.com/shirou/gopsutil/v3 v3.22.10 // indirect | 	github.com/shirou/gopsutil/v3 v3.22.10 // indirect | ||||||
| 	github.com/tklauser/go-sysconf v0.3.11 // indirect | 	github.com/tklauser/go-sysconf v0.3.11 // indirect | ||||||
| 	github.com/tklauser/numcpus v0.6.0 // indirect | 	github.com/tklauser/numcpus v0.6.0 // indirect | ||||||
|  | 	github.com/yapingcat/gomedia v0.0.0-20230222121919-c67df405bf33 // indirect | ||||||
| 	github.com/yusufpapurcu/wmi v1.2.2 // indirect | 	github.com/yusufpapurcu/wmi v1.2.2 // indirect | ||||||
| 	go.uber.org/atomic v1.10.0 // indirect | 	go.uber.org/atomic v1.10.0 // indirect | ||||||
| 	go.uber.org/multierr v1.8.0 // indirect | 	go.uber.org/multierr v1.8.0 // indirect | ||||||
| 	golang.org/x/crypto v0.3.0 // indirect | 	golang.org/x/crypto v0.4.0 // indirect | ||||||
| 	golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 // indirect | 	golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect | ||||||
| 	golang.org/x/mod v0.7.0 // indirect | 	golang.org/x/mod v0.7.0 // indirect | ||||||
| 	golang.org/x/net v0.2.0 // indirect | 	golang.org/x/net v0.9.0 // indirect | ||||||
| 	golang.org/x/sync v0.1.0 // indirect | 	golang.org/x/sync v0.1.0 // indirect | ||||||
| 	golang.org/x/sys v0.2.0 // indirect | 	golang.org/x/sys v0.7.0 // indirect | ||||||
| 	golang.org/x/tools v0.3.0 // indirect | 	golang.org/x/tools v0.3.0 // indirect | ||||||
| 	gopkg.in/yaml.v3 v3.0.1 // indirect | 	gopkg.in/yaml.v3 v3.0.1 // indirect | ||||||
| ) | ) | ||||||
|   | |||||||
							
								
								
									
										62
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										62
									
								
								go.sum
									
									
									
									
									
								
							| @@ -1,7 +1,13 @@ | |||||||
| github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||||||
| github.com/aler9/gortsplib v0.0.0-20221115222755-87d5a512b129 h1:CG96FPsxizdlpsRIsjU2xQR6G3QC0sPK+f+AeVEr0Tg= | github.com/aler9/gortsplib v1.0.1 h1:R13+hxlvg2Hvu98+0hzg0o5fPjyUA9ZPJneMIBxKGXk= | ||||||
| github.com/aler9/gortsplib v0.0.0-20221115222755-87d5a512b129/go.mod h1:BOWNZ/QBkY/eVcRqUzJbPFEsRJshwxaxBT01K260Jeo= | github.com/aler9/gortsplib v1.0.1/go.mod h1:BOWNZ/QBkY/eVcRqUzJbPFEsRJshwxaxBT01K260Jeo= | ||||||
|  | github.com/aler9/gortsplib/v2 v2.2.2 h1:tTw8pdKSOEjlZjjE1S4ftXPHJkYOqjNNv3hjQ0Nto9M= | ||||||
|  | github.com/aler9/gortsplib/v2 v2.2.2/go.mod h1:k6uBVHGwsIc/0L5SLLqWwi6bSJUb4VR0HfvncyHlKQI= | ||||||
| github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= | github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= | ||||||
|  | github.com/bluenviron/gortsplib/v3 v3.2.1 h1:wdMocTWu1EWa9PPWb8F/S6LY2hZikgrs7zgDtnwBPO0= | ||||||
|  | github.com/bluenviron/gortsplib/v3 v3.2.1/go.mod h1:AzHdywoBckre5q9Y581xg93PVthXayVHVqYMc3hwBlk= | ||||||
|  | github.com/bluenviron/mediacommon v0.2.1 h1:NkbbXwjMqspatQwSyGDYqxg14ftxJSjNsnPNocUxScw= | ||||||
|  | github.com/bluenviron/mediacommon v0.2.1/go.mod h1:t0dqPsWUTchyvib0MhixIwXEgvDX4V9G+I0GzWLQRb8= | ||||||
| github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= | github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= | ||||||
| github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= | github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= | ||||||
| github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= | github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= | ||||||
| @@ -13,10 +19,11 @@ 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/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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||||
| github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||||
|  | github.com/denisbrodbeck/machineid v1.0.1 h1:geKr9qtkB876mXguW2X6TU4ZynleN6ezuMSRhl4D7AQ= | ||||||
|  | github.com/denisbrodbeck/machineid v1.0.1/go.mod h1:dJUwb7PTidGDeYyUBmXZ2GphQBbjJCrnectwCyxcUSI= | ||||||
| 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/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= | github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= | ||||||
| @@ -54,22 +61,18 @@ github.com/kelindar/process v0.0.0-20170730150328-69a29e249ec3/go.mod h1:+lTCLnZ | |||||||
| 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/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||||||
| github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= |  | ||||||
| github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | 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.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 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/lucas-clemente/quic-go v0.31.0 h1:MfNp3fk0wjWRajw6quMFA3ap1AVtlU+2mtwmbVogB2M= |  | ||||||
| github.com/lucas-clemente/quic-go v0.31.0/go.mod h1:0wFbizLgYzqHqtlyxyCaJKlE7bYgE6JQ+54TLd/Dq2g= |  | ||||||
| github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= | github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I= | ||||||
| github.com/lufia/plan9stats v0.0.0-20220913051719-115f729f3c8c h1:VtwQ41oftZwlMnOEbMWQtSEUgU64U4s+GHk7hZK+jtY= | 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/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/mcuadros/go-defaults v1.2.0 h1:FODb8WSf0uGaY8elWJAkoLL0Ri6AlZ1bFlenk56oZtc= | ||||||
| github.com/marten-seemann/qtls-go1-18 v0.1.3/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= | github.com/mcuadros/go-defaults v1.2.0/go.mod h1:WEZtHEVIGYVDqkKSWBdWKUVdRyKlMfulPaGDWIVeCWY= | ||||||
| github.com/marten-seemann/qtls-go1-19 v0.1.1 h1:mnbxeq3oEyQxQXwI4ReCgW9DPoPR94sNlqWoDZnjRIE= | github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= | ||||||
| github.com/marten-seemann/qtls-go1-19 v0.1.1/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI= | 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.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= | ||||||
| github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= | 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= | ||||||
| @@ -121,7 +124,14 @@ github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c h1:NRoLoZvkB | |||||||
| github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= | 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 h1:Lhh29o65C4PmTDj2l+eKfsw9dddpgWZk4bFICtcnSaA= | ||||||
| github.com/q191201771/naza v0.30.8/go.mod h1:n+dpJjQSh90PxBwxBNuifOwQttywvSIN5TkWSSYCeBk= | github.com/q191201771/naza v0.30.8/go.mod h1:n+dpJjQSh90PxBwxBNuifOwQttywvSIN5TkWSSYCeBk= | ||||||
| github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= | github.com/quic-go/qtls-go1-18 v0.2.0 h1:5ViXqBZ90wpUcZS0ge79rf029yx0dYB0McyPJwqqj7U= | ||||||
|  | github.com/quic-go/qtls-go1-18 v0.2.0/go.mod h1:moGulGHK7o6O8lSPSZNoOwcLvJKJ85vVNc7oJFD65bc= | ||||||
|  | github.com/quic-go/qtls-go1-19 v0.2.0 h1:Cvn2WdhyViFUHoOqK52i51k4nDX8EwIh5VJiVM4nttk= | ||||||
|  | github.com/quic-go/qtls-go1-19 v0.2.0/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI= | ||||||
|  | github.com/quic-go/qtls-go1-20 v0.1.0 h1:d1PK3ErFy9t7zxKsG3NXBJXZjp/kMLoIb3y/kV54oAI= | ||||||
|  | github.com/quic-go/qtls-go1-20 v0.1.0/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM= | ||||||
|  | github.com/quic-go/quic-go v0.32.0 h1:lY02md31s1JgPiiyfqJijpu/UX/Iun304FI3yUqX7tA= | ||||||
|  | github.com/quic-go/quic-go v0.32.0/go.mod h1:/fCsKANhQIeD5l76c2JFU+07gVE3KaA0FP+0zMWwfwo= | ||||||
| github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= | 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 h1:4KMHdfBRYXGF9skjDWiL4RA2N+E8dRdodU/bOZpPoVg= | ||||||
| github.com/shirou/gopsutil/v3 v3.22.10/go.mod h1:QNza6r4YQoydyCfo6rH0blGfKahgibh4dQmV5xdFkQk= | github.com/shirou/gopsutil/v3 v3.22.10/go.mod h1:QNza6r4YQoydyCfo6rH0blGfKahgibh4dQmV5xdFkQk= | ||||||
| @@ -135,14 +145,16 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ | |||||||
| github.com/stretchr/testify v1.7.0/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.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.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/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= | ||||||
|  | github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= | ||||||
| github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= | 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 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= | ||||||
| github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= | 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.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 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms= | ||||||
| github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= | github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= | ||||||
|  | github.com/yapingcat/gomedia v0.0.0-20230222121919-c67df405bf33 h1:uyZY++dluUg7iTSsNzuOVln/mC2U2KXwgKLfKLCJ74Y= | ||||||
|  | github.com/yapingcat/gomedia v0.0.0-20230222121919-c67df405bf33/go.mod h1:WSZ59bidJOO40JSJmLqlkBJrjZCtjbKKkygEMfzY/kc= | ||||||
| github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= | 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.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= | ||||||
| github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= | ||||||
| @@ -163,10 +175,10 @@ golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWP | |||||||
| golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= | 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-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.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.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= | ||||||
| golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= | golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= | ||||||
| golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 h1:yZNXmy+j/JpX19vZkVktWqAo7Gny4PBWYYK3zskGpx4= | golang.org/x/exp v0.0.0-20221205204356-47842c84f3db h1:D/cFflL63o2KSLJIwjlcIt8PR064j/xsmdEJL/YvY/o= | ||||||
| golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= | golang.org/x/exp v0.0.0-20221205204356-47842c84f3db/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= | ||||||
| golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= | 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.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.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= | ||||||
| @@ -188,8 +200,8 @@ golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su | |||||||
| golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= | 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.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.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= | ||||||
| golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= | golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= | ||||||
| golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= | golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= | ||||||
| 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-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | golang.org/x/sync v0.0.0-20190423024810-112230192c58/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-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | ||||||
| @@ -222,8 +234,9 @@ golang.org/x/sys v0.0.0-20220608164250-635b8c9b7f68/go.mod h1:oPkhp1MJrh7nUepCBc | |||||||
| golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/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.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.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
| golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= |  | ||||||
| golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||||
|  | golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= | ||||||
|  | golang.org/x/sys v0.7.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.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= | ||||||
| @@ -232,8 +245,8 @@ 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.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.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= | ||||||
| golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= |  | ||||||
| golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= | golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= | ||||||
|  | golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= | ||||||
| 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-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.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= | ||||||
| @@ -255,8 +268,9 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 | |||||||
| google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= | ||||||
| google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= | 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 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= |  | ||||||
| gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/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= | ||||||
| @@ -269,5 +283,5 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C | |||||||
| gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||||||
| gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= | ||||||
| m7s.live/engine/v4 v4.10.0 h1:U47ifoIC41lXisvG69Os4GtUTnYhAOzV/dZSj4OYVZg= | m7s.live/engine/v4 v4.11.18 h1:tgINiHqrrLdWEnoFZ0n2gSwoQwPwBgz+V/NXgo5K4Ks= | ||||||
| m7s.live/engine/v4 v4.10.0/go.mod h1:znB5Ux7fJ/bIVKnbHrwoInztVn7z/4CrXwjc24b1exI= | m7s.live/engine/v4 v4.11.18/go.mod h1:YoOThdhOpkf7MUDWciy449vfBF7i1p+dtf5o32hOvXY= | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								main.go
									
									
									
									
									
								
							| @@ -6,7 +6,7 @@ import ( | |||||||
| 	"sync" | 	"sync" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/aler9/gortsplib" | 	"github.com/bluenviron/gortsplib/v3" | ||||||
| 	"go.uber.org/zap" | 	"go.uber.org/zap" | ||||||
| 	. "m7s.live/engine/v4" | 	. "m7s.live/engine/v4" | ||||||
| 	"m7s.live/engine/v4/config" | 	"m7s.live/engine/v4/config" | ||||||
| @@ -18,10 +18,11 @@ type RTSPConfig struct { | |||||||
| 	config.Subscribe | 	config.Subscribe | ||||||
| 	config.Pull | 	config.Pull | ||||||
| 	config.Push | 	config.Push | ||||||
| 	ListenAddr     string | 	ListenAddr       string `default:":554"` | ||||||
| 	UDPAddr        string | 	UDPAddr          string `default:":8000"` | ||||||
| 	RTCPAddr       string | 	RTCPAddr         string `default:":8001"` | ||||||
| 	ReadBufferSize int | 	ReadBufferCount  int    `default:"2048"` | ||||||
|  | 	WriteBufferCount int    `default:"2048"` | ||||||
| 	PullProtocol     string //tcp、udp、 auto(default) | 	PullProtocol     string //tcp、udp、 auto(default) | ||||||
| 	sync.Map | 	sync.Map | ||||||
| } | } | ||||||
| @@ -37,6 +38,8 @@ func (conf *RTSPConfig) OnEvent(event any) { | |||||||
| 			MulticastIPRange:  "224.1.0.0/16", | 			MulticastIPRange:  "224.1.0.0/16", | ||||||
| 			MulticastRTPPort:  8002, | 			MulticastRTPPort:  8002, | ||||||
| 			MulticastRTCPPort: 8003, | 			MulticastRTCPPort: 8003, | ||||||
|  | 			ReadBufferCount:   conf.ReadBufferCount, | ||||||
|  | 			WriteBufferCount:  conf.WriteBufferCount, | ||||||
| 		} | 		} | ||||||
| 		if err := s.Start(); err != nil { | 		if err := s.Start(); err != nil { | ||||||
| 			RTSPPlugin.Error("server start", zap.Error(err)) | 			RTSPPlugin.Error("server start", zap.Error(err)) | ||||||
| @@ -49,7 +52,7 @@ func (conf *RTSPConfig) OnEvent(event any) { | |||||||
| 		} | 		} | ||||||
| 	case SEpublish: | 	case SEpublish: | ||||||
| 		for streamPath, url := range conf.PushList { | 		for streamPath, url := range conf.PushList { | ||||||
| 			if streamPath == v.Stream.Path { | 			if streamPath == v.Target.Path { | ||||||
| 				if err := RTSPPlugin.Push(streamPath, url, new(RTSPPusher), false); err != nil { | 				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)) | 					RTSPPlugin.Error("push", zap.String("streamPath", streamPath), zap.String("url", url), zap.Error(err)) | ||||||
| 				} | 				} | ||||||
| @@ -67,12 +70,7 @@ func (conf *RTSPConfig) OnEvent(event any) { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| var rtspConfig = &RTSPConfig{ | var rtspConfig = &RTSPConfig{} | ||||||
| 	ListenAddr:     ":554", |  | ||||||
| 	UDPAddr:        ":8000", |  | ||||||
| 	RTCPAddr:       ":8001", |  | ||||||
| 	ReadBufferSize: 2048, |  | ||||||
| } |  | ||||||
| var RTSPPlugin = InstallPlugin(rtspConfig) | var RTSPPlugin = InstallPlugin(rtspConfig) | ||||||
|  |  | ||||||
| func filterStreams() (ss []*Stream) { | func filterStreams() (ss []*Stream) { | ||||||
|   | |||||||
							
								
								
									
										180
									
								
								publisher.go
									
									
									
									
									
								
							
							
						
						
									
										180
									
								
								publisher.go
									
									
									
									
									
								
							| @@ -1,143 +1,103 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"encoding/base64" | 	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" | ||||||
| 	"encoding/hex" | 	"github.com/bluenviron/gortsplib/v3/pkg/formats" | ||||||
| 	"errors" | 	"github.com/bluenviron/gortsplib/v3/pkg/media" | ||||||
| 	"fmt" | 	"github.com/pion/rtp" | ||||||
| 	"strconv" |  | ||||||
| 	"strings" |  | ||||||
|  |  | ||||||
| 	"github.com/aler9/gortsplib" |  | ||||||
| 	"go.uber.org/zap" | 	"go.uber.org/zap" | ||||||
| 	. "m7s.live/engine/v4" | 	. "m7s.live/engine/v4" | ||||||
| 	"m7s.live/engine/v4/common" | 	"m7s.live/engine/v4/common" | ||||||
| 	. "m7s.live/engine/v4/track" | 	. "m7s.live/engine/v4/track" | ||||||
|  | 	"m7s.live/engine/v4/util" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type RTSPPublisher struct { | type RTSPPublisher struct { | ||||||
| 	Publisher | 	Publisher | ||||||
| 	Tracks []common.AVTrack `json:"-"` | 	Tracks map[*media.Media]common.AVTrack `json:"-" yaml:"-"` | ||||||
| 	RTSPIO | 	RTSPIO | ||||||
| } | } | ||||||
|  |  | ||||||
| func (p *RTSPPublisher) SetTracks() error { | func (p *RTSPPublisher) SetTracks() error { | ||||||
| 	p.Tracks = make([]common.AVTrack, len(p.tracks)) | 	p.Tracks = make(map[*media.Media]common.AVTrack, len(p.tracks)) | ||||||
| 	defer func() { | 	defer func() { | ||||||
| 		for i, track := range p.Tracks { | 		for _, track := range p.Tracks { | ||||||
| 			p.Info("set track", zap.Int("trackId", i), zap.String("name", track.GetBase().Name)) | 			p.Info("set track", zap.String("name", track.GetBase().Name)) | ||||||
| 		} | 		} | ||||||
| 	}() | 	}() | ||||||
| 	for trackId, track := range p.tracks { | 	for _, track := range p.tracks { | ||||||
| 		md := track.MediaDescription() | 		for _, forma := range track.Formats { | ||||||
| 		v, ok := md.Attribute("rtpmap") | 			switch f := forma.(type) { | ||||||
| 		if !ok { | 			case *formats.H264: | ||||||
| 			return errors.New("rtpmap attribute not found") | 				vt := p.VideoTrack | ||||||
|  | 				if vt == nil { | ||||||
|  | 					vt = NewH264(p.Stream, f.PayloadType(), make(util.BytesPool, 17)) | ||||||
|  | 					p.VideoTrack = vt | ||||||
| 				} | 				} | ||||||
| 		v = strings.TrimSpace(v) | 				p.Tracks[track] = p.VideoTrack | ||||||
| 		vals := strings.Split(v, " ") | 				if len(f.SPS) > 0 { | ||||||
| 		if len(vals) != 2 { | 					vt.WriteSliceBytes(f.SPS) | ||||||
| 			continue |  | ||||||
| 				} | 				} | ||||||
| 		fmtp := make(map[string]string) | 				if len(f.PPS) > 0 { | ||||||
| 		if v, ok = md.Attribute("fmtp"); ok { | 					vt.WriteSliceBytes(f.PPS) | ||||||
| 			if tmp := strings.SplitN(v, " ", 2); len(tmp) == 2 { |  | ||||||
| 				for _, kv := range strings.Split(tmp[1], ";") { |  | ||||||
| 					kv = strings.Trim(kv, " ") |  | ||||||
|  |  | ||||||
| 					if len(kv) == 0 { |  | ||||||
| 						continue |  | ||||||
| 				} | 				} | ||||||
| 					tmp := strings.SplitN(kv, "=", 2) | 			case *formats.H265: | ||||||
| 					if len(tmp) == 2 { | 				vt := p.VideoTrack | ||||||
| 						fmtp[strings.TrimSpace(tmp[0])] = tmp[1] | 				if vt == nil { | ||||||
|  | 					vt = NewH265(p.Stream, f.PayloadType(), make(util.BytesPool, 17)) | ||||||
|  | 					p.VideoTrack = vt | ||||||
| 				} | 				} | ||||||
|  | 				p.Tracks[track] = p.VideoTrack | ||||||
|  | 				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) | ||||||
| 				} | 				} | ||||||
| 		timeScale := 0 | 			case *formats.MPEG4Audio: | ||||||
| 		keyval := strings.Split(vals[1], "/") | 				at := p.AudioTrack | ||||||
| 		if i, err := strconv.Atoi(keyval[1]); err == nil { | 				if at == nil { | ||||||
| 			timeScale = i | 					at := NewAAC(p.Stream, f.PayloadType(), uint32(f.Config.SampleRate), make(util.BytesPool, 17)) | ||||||
|  | 					at.IndexDeltaLength = f.IndexDeltaLength | ||||||
|  | 					at.IndexLength = f.IndexLength | ||||||
|  | 					at.SizeLength = f.SizeLength | ||||||
|  | 					if f.Config.Type == mpeg4audio.ObjectTypeAACLC { | ||||||
|  | 						at.Mode = 1 | ||||||
| 					} | 					} | ||||||
| 		if len(keyval) >= 2 { | 					at.Channels = uint8(f.Config.ChannelCount) | ||||||
| 			switch strings.ToLower(keyval[0]) { | 					asc, _ := f.Config.Marshal() | ||||||
| 			case "h264": |  | ||||||
| 				vt := NewH264(p.Stream) |  | ||||||
| 				if payloadType, err := strconv.Atoi(vals[0]); err == nil { |  | ||||||
| 					vt.DecoderConfiguration.PayloadType = byte(payloadType) |  | ||||||
| 				} |  | ||||||
| 				p.Tracks[trackId] = vt |  | ||||||
| 				t := track.(*gortsplib.TrackH264) |  | ||||||
| 				if len(t.SPS) > 0 { |  | ||||||
| 					vt.WriteSliceBytes(t.SPS) |  | ||||||
| 				} |  | ||||||
| 				if len(t.PPS) > 0 { |  | ||||||
| 					vt.WriteSliceBytes(t.PPS) |  | ||||||
| 				} |  | ||||||
| 			case "h265", "hevc": |  | ||||||
| 				vt := NewH265(p.Stream) |  | ||||||
| 				if payloadType, err := strconv.Atoi(vals[0]); err == nil { |  | ||||||
| 					vt.DecoderConfiguration.PayloadType = byte(payloadType) |  | ||||||
| 				} |  | ||||||
| 				p.Tracks[trackId] = vt |  | ||||||
| 				if v, ok := fmtp["sprop-vps"]; ok { |  | ||||||
| 					vps, _ := base64.StdEncoding.DecodeString(v) |  | ||||||
| 					vt.WriteSliceBytes(vps) |  | ||||||
| 				} |  | ||||||
| 				if v, ok := fmtp["sprop-sps"]; ok { |  | ||||||
| 					sps, _ := base64.StdEncoding.DecodeString(v) |  | ||||||
| 					vt.WriteSliceBytes(sps) |  | ||||||
| 				} |  | ||||||
| 				if v, ok := fmtp["sprop-pps"]; ok { |  | ||||||
| 					pps, _ := base64.StdEncoding.DecodeString(v) |  | ||||||
| 					vt.WriteSliceBytes(pps) |  | ||||||
| 				} |  | ||||||
| 			case "pcma": |  | ||||||
| 				at := NewG711(p.Stream, true) |  | ||||||
| 				if payloadType, err := strconv.Atoi(vals[0]); err == nil { |  | ||||||
| 					at.DecoderConfiguration.PayloadType = byte(payloadType) |  | ||||||
| 				} |  | ||||||
| 				p.Tracks[trackId] = at |  | ||||||
| 				at.SampleRate = uint32(timeScale) |  | ||||||
| 				if len(keyval) >= 3 { |  | ||||||
| 					x, _ := strconv.Atoi(keyval[2]) |  | ||||||
| 					at.Channels = byte(x) |  | ||||||
| 				} else { |  | ||||||
| 					at.Channels = 1 |  | ||||||
| 				} |  | ||||||
| 				at.AVCCHead = []byte{(byte(at.CodecID) << 4) | (1 << 1)} |  | ||||||
| 			case "pcmu": |  | ||||||
| 				at := NewG711(p.Stream, false) |  | ||||||
| 				if payloadType, err := strconv.Atoi(vals[0]); err == nil { |  | ||||||
| 					at.DecoderConfiguration.PayloadType = byte(payloadType) |  | ||||||
| 				} |  | ||||||
| 				p.Tracks[trackId] = at |  | ||||||
| 				at.SampleRate = uint32(timeScale) |  | ||||||
| 				if len(keyval) >= 3 { |  | ||||||
| 					x, _ := strconv.Atoi(keyval[2]) |  | ||||||
| 					at.Channels = byte(x) |  | ||||||
| 				} else { |  | ||||||
| 					at.Channels = 1 |  | ||||||
| 				} |  | ||||||
| 				at.AVCCHead = []byte{(byte(at.CodecID) << 4) | (1 << 1)} |  | ||||||
| 			case "mpeg4-generic": |  | ||||||
| 				at := NewAAC(p.Stream) |  | ||||||
| 				if payloadType, err := strconv.Atoi(vals[0]); err == nil { |  | ||||||
| 					at.DecoderConfiguration.PayloadType = byte(payloadType) |  | ||||||
| 				} |  | ||||||
| 				p.Tracks[trackId] = at |  | ||||||
| 				if config, ok := fmtp["config"]; ok { |  | ||||||
| 					asc, _ := hex.DecodeString(config) |  | ||||||
| 					// 复用AVCC写入逻辑,解析出AAC的配置信息 | 					// 复用AVCC写入逻辑,解析出AAC的配置信息 | ||||||
| 					at.WriteAVCC(0, append([]byte{0xAF, 0}, asc...)) | 					at.WriteSequenceHead(append([]byte{0xAF, 0x00}, asc...)) | ||||||
| 				} else { | 					p.AudioTrack = at | ||||||
| 					RTSPPlugin.Warn("aac no config") |  | ||||||
| 				} | 				} | ||||||
| 			default: | 				p.Tracks[track] = p.AudioTrack | ||||||
| 				return fmt.Errorf("unsupport codec:%s", keyval[0]) | 			case *formats.G711: | ||||||
|  | 				at := p.AudioTrack | ||||||
|  | 				if at == nil { | ||||||
|  | 					at := NewG711(p.Stream, !f.MULaw, f.PayloadType(), uint32(f.ClockRate()), make(util.BytesPool, 17)) | ||||||
|  | 					at.AVCCHead = []byte{(byte(at.CodecID) << 4) | (1 << 1)} | ||||||
|  | 					p.AudioTrack = at | ||||||
|  | 				} | ||||||
|  | 				p.Tracks[track] = p.AudioTrack | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	if p.VideoTrack == nil { | ||||||
|  | 		p.Config.PubVideo = false | ||||||
|  | 		p.Info("no video track") | ||||||
|  | 	} | ||||||
|  | 	if p.AudioTrack == nil { | ||||||
|  | 		p.Config.PubAudio = false | ||||||
|  | 		p.Info("no audio track") | ||||||
|  | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func (p *RTSPPublisher) OnPacket(m *media.Media, f formats.Format, pack *rtp.Packet) { | ||||||
|  | 	if t, ok := p.Tracks[m]; ok { | ||||||
|  | 		t.WriteRTPPack(pack) | ||||||
|  | 	} | ||||||
|  | } | ||||||
|   | |||||||
							
								
								
									
										35
									
								
								server.go
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								server.go
									
									
									
									
									
								
							| @@ -1,16 +1,17 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/aler9/gortsplib" | 	"github.com/bluenviron/gortsplib/v3" | ||||||
| 	"github.com/aler9/gortsplib/pkg/base" | 	"github.com/bluenviron/gortsplib/v3/pkg/base" | ||||||
|  | 	"github.com/bluenviron/gortsplib/v3/pkg/media" | ||||||
| 	. "m7s.live/engine/v4" | 	. "m7s.live/engine/v4" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| type RTSPIO struct { | type RTSPIO struct { | ||||||
| 	tracks       gortsplib.Tracks | 	tracks     media.Medias | ||||||
| 	stream     *gortsplib.ServerStream | 	stream     *gortsplib.ServerStream | ||||||
| 	audioTrackId int | 	audioTrack *media.Media | ||||||
| 	videoTrackId int | 	videoTrack *media.Media | ||||||
| } | } | ||||||
|  |  | ||||||
| func (conf *RTSPConfig) OnConnOpen(ctx *gortsplib.ServerHandlerOnConnOpenCtx) { | func (conf *RTSPConfig) OnConnOpen(ctx *gortsplib.ServerHandlerOnConnOpenCtx) { | ||||||
| @@ -30,9 +31,9 @@ func (conf *RTSPConfig) OnSessionOpen(ctx *gortsplib.ServerHandlerOnSessionOpenC | |||||||
|  |  | ||||||
| func (conf *RTSPConfig) OnSessionClose(ctx *gortsplib.ServerHandlerOnSessionCloseCtx) { | func (conf *RTSPConfig) OnSessionClose(ctx *gortsplib.ServerHandlerOnSessionCloseCtx) { | ||||||
| 	RTSPPlugin.Debug("session closed") | 	RTSPPlugin.Debug("session closed") | ||||||
| 	if p, ok := conf.LoadAndDelete(ctx.Session); ok { | 	// if p, ok := conf.LoadAndDelete(ctx.Session); ok { | ||||||
| 		p.(IIO).Stop() | 	// 	p.(IIO).Stop() | ||||||
| 	} | 	// } | ||||||
| } | } | ||||||
|  |  | ||||||
| // called after receiving a DESCRIBE request. | // called after receiving a DESCRIBE request. | ||||||
| @@ -88,6 +89,9 @@ func (conf *RTSPConfig) OnPlay(ctx *gortsplib.ServerHandlerOnPlayCtx) (*base.Res | |||||||
| 	return &resp, nil | 	return &resp, nil | ||||||
| } | } | ||||||
| func (conf *RTSPConfig) OnRecord(ctx *gortsplib.ServerHandlerOnRecordCtx) (*base.Response, error) { | 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{ | 	return &base.Response{ | ||||||
| 		StatusCode: base.StatusOK, | 		StatusCode: base.StatusOK, | ||||||
| 	}, nil | 	}, nil | ||||||
| @@ -96,8 +100,8 @@ func (conf *RTSPConfig) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (* | |||||||
| 	p := &RTSPPublisher{} | 	p := &RTSPPublisher{} | ||||||
| 	p.SetIO(ctx.Conn.NetConn()) | 	p.SetIO(ctx.Conn.NetConn()) | ||||||
| 	if err := RTSPPlugin.Publish(ctx.Path, p); err == nil { | 	if err := RTSPPlugin.Publish(ctx.Path, p); err == nil { | ||||||
| 		p.tracks = ctx.Tracks | 		p.tracks = ctx.Medias | ||||||
| 		p.stream = gortsplib.NewServerStream(ctx.Tracks) | 		p.stream = gortsplib.NewServerStream(ctx.Medias) | ||||||
| 		if err = p.SetTracks(); err != nil { | 		if err = p.SetTracks(); err != nil { | ||||||
| 			return nil, err | 			return nil, err | ||||||
| 		} | 		} | ||||||
| @@ -112,14 +116,3 @@ func (conf *RTSPConfig) OnAnnounce(ctx *gortsplib.ServerHandlerOnAnnounceCtx) (* | |||||||
| 		StatusCode: base.StatusOK, | 		StatusCode: base.StatusOK, | ||||||
| 	}, nil | 	}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func (conf *RTSPConfig) OnPacketRTP(ctx *gortsplib.ServerHandlerOnPacketRTPCtx) { |  | ||||||
| 	if p, ok := conf.Load(ctx.Session); ok { |  | ||||||
| 		switch v := p.(type) { |  | ||||||
| 		case *RTSPPublisher: |  | ||||||
| 			if v.Tracks[ctx.TrackID] != nil { |  | ||||||
| 				v.Tracks[ctx.TrackID].WriteRTPPack(ctx.Packet) |  | ||||||
| 			} |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|   | |||||||
| @@ -1,8 +1,10 @@ | |||||||
| package rtsp | package rtsp | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
| 	"github.com/aler9/gortsplib" | 	"github.com/bluenviron/gortsplib/v3" | ||||||
| 	"github.com/aler9/gortsplib/pkg/mpeg4audio" | 	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio" | ||||||
|  | 	"github.com/bluenviron/gortsplib/v3/pkg/formats" | ||||||
|  | 	"github.com/bluenviron/gortsplib/v3/pkg/media" | ||||||
| 	. "m7s.live/engine/v4" | 	. "m7s.live/engine/v4" | ||||||
| 	"m7s.live/engine/v4/codec" | 	"m7s.live/engine/v4/codec" | ||||||
| 	"m7s.live/engine/v4/track" | 	"m7s.live/engine/v4/track" | ||||||
| @@ -16,52 +18,82 @@ type RTSPSubscriber struct { | |||||||
| func (s *RTSPSubscriber) OnEvent(event any) { | func (s *RTSPSubscriber) OnEvent(event any) { | ||||||
| 	switch v := event.(type) { | 	switch v := event.(type) { | ||||||
| 	case *track.Video: | 	case *track.Video: | ||||||
| 		if s.Video.Track != nil { | 		if s.Video != nil { | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 		switch v.CodecID { | 		switch v.CodecID { | ||||||
| 		case codec.CodecID_H264: | 		case codec.CodecID_H264: | ||||||
| 			extra := v.DecoderConfiguration.Raw | 			video := &media.Media{ | ||||||
| 			vtrack := &gortsplib.TrackH264{ | 				Type: media.TypeVideo, | ||||||
| 				PayloadType: v.DecoderConfiguration.PayloadType, SPS: extra[0], PPS: extra[1], | 				Formats: []formats.Format{&formats.H264{ | ||||||
|  | 					PacketizationMode: 1, | ||||||
|  | 					PayloadTyp:        v.PayloadType, | ||||||
|  | 					SPS:               v.ParamaterSets[0], | ||||||
|  | 					PPS:               v.ParamaterSets[1], | ||||||
|  | 				}}, | ||||||
| 			} | 			} | ||||||
| 			s.videoTrackId = len(s.tracks) | 			s.videoTrack = video | ||||||
| 			s.tracks = append(s.tracks, vtrack) | 			s.tracks = append(s.tracks, video) | ||||||
| 		case codec.CodecID_H265: | 		case codec.CodecID_H265: | ||||||
| 			vtrack := &gortsplib.TrackH265{ | 			video := &media.Media{ | ||||||
| 				PayloadType: v.DecoderConfiguration.PayloadType, VPS: v.DecoderConfiguration.Raw[0], SPS: v.DecoderConfiguration.Raw[1], PPS: v.DecoderConfiguration.Raw[2], | 				Type: media.TypeVideo, | ||||||
|  | 				Formats: []formats.Format{&formats.H265{ | ||||||
|  | 					PayloadTyp: v.PayloadType, | ||||||
|  | 					VPS:        v.ParamaterSets[0], | ||||||
|  | 					SPS:        v.ParamaterSets[1], | ||||||
|  | 					PPS:        v.ParamaterSets[2], | ||||||
|  | 				}}, | ||||||
| 			} | 			} | ||||||
| 			s.videoTrackId = len(s.tracks) | 			s.videoTrack = video | ||||||
| 			s.tracks = append(s.tracks, vtrack) | 			s.tracks = append(s.tracks, video) | ||||||
| 		} | 		} | ||||||
| 		s.AddTrack(v) | 		s.AddTrack(v) | ||||||
| 	case *track.Audio: | 	case *track.Audio: | ||||||
| 		if s.Audio.Track != nil { | 		if s.Audio != nil { | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 		switch v.CodecID { | 		switch v.CodecID { | ||||||
| 		case codec.CodecID_AAC: | 		case codec.CodecID_AAC: | ||||||
| 			var mpegConf mpeg4audio.Config | 			audio := &media.Media{ | ||||||
| 			mpegConf.Unmarshal(v.DecoderConfiguration.Raw) | 				Type: media.TypeAudio, | ||||||
| 			atrack := &gortsplib.TrackMPEG4Audio{ | 				Formats: []formats.Format{&formats.MPEG4Audio{ | ||||||
| 				PayloadType: v.DecoderConfiguration.PayloadType, Config: &mpegConf, SizeLength: 13, IndexLength: 3, IndexDeltaLength: 3, | 					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.audioTrackId = len(s.tracks) | 			s.audioTrack = audio | ||||||
| 			s.tracks = append(s.tracks, atrack) | 			s.tracks = append(s.tracks, audio) | ||||||
| 		case codec.CodecID_PCMA: | 		case codec.CodecID_PCMA: | ||||||
| 			s.audioTrackId = len(s.tracks) | 			audio := &media.Media{ | ||||||
| 			s.tracks = append(s.tracks, &gortsplib.TrackPCMA{}) | 				Type:    media.TypeAudio, | ||||||
|  | 				Formats: []formats.Format{&formats.G711{}}, | ||||||
|  | 			} | ||||||
|  | 			s.audioTrack = audio | ||||||
|  | 			s.tracks = append(s.tracks, audio) | ||||||
| 		case codec.CodecID_PCMU: | 		case codec.CodecID_PCMU: | ||||||
| 			s.audioTrackId = len(s.tracks) | 			audio := &media.Media{ | ||||||
| 			s.tracks = append(s.tracks, &gortsplib.TrackPCMU{}) | 				Type: media.TypeAudio, | ||||||
|  | 				Formats: []formats.Format{&formats.G711{ | ||||||
|  | 					MULaw: true, | ||||||
|  | 				}}, | ||||||
|  | 			} | ||||||
|  | 			s.audioTrack = audio | ||||||
|  | 			s.tracks = append(s.tracks, audio) | ||||||
| 		} | 		} | ||||||
| 		s.AddTrack(v) | 		s.AddTrack(v) | ||||||
| 	case ISubscriber: | 	case ISubscriber: | ||||||
| 		s.stream = gortsplib.NewServerStream(s.tracks) | 		s.stream = gortsplib.NewServerStream(s.tracks) | ||||||
| 	case VideoRTP: | 	case VideoRTP: | ||||||
| 		s.stream.WritePacketRTP(s.videoTrackId, &v.Packet) | 		s.stream.WritePacketRTP(s.videoTrack, v.Packet) | ||||||
| 	case AudioRTP: | 	case AudioRTP: | ||||||
| 		s.stream.WritePacketRTP(s.audioTrackId, &v.Packet) | 		s.stream.WritePacketRTP(s.audioTrack, v.Packet) | ||||||
| 	default: | 	default: | ||||||
| 		s.Subscriber.OnEvent(event) | 		s.Subscriber.OnEvent(event) | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user