protocol update: explicit AddTrack to move negotiation initiation to server side.

In order to avoid race conditions with WebRTC, where either side could initiate an offer when tracks have changes, we'll always initiate them from the SFU side.
This commit is contained in:
David Zhao
2021-01-09 23:40:29 -08:00
parent 0336e9d92f
commit 258f5add2d
34 changed files with 2218 additions and 1657 deletions
+45 -53
View File
@@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"io" "io"
"path/filepath" "path/filepath"
"strings"
"sync" "sync"
"time" "time"
@@ -17,6 +18,7 @@ import (
"github.com/livekit/livekit-server/pkg/logger" "github.com/livekit/livekit-server/pkg/logger"
"github.com/livekit/livekit-server/pkg/rtc" "github.com/livekit/livekit-server/pkg/rtc"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/proto/livekit" "github.com/livekit/livekit-server/proto/livekit"
) )
@@ -100,25 +102,24 @@ func NewRTCClient(conn *websocket.Conn) (*RTCClient, error) {
peerConn.OnTrack(func(track *webrtc.TrackRemote, rtpReceiver *webrtc.RTPReceiver) { peerConn.OnTrack(func(track *webrtc.TrackRemote, rtpReceiver *webrtc.RTPReceiver) {
c.AppendLog("track received", "label", track.StreamID(), "id", track.ID()) c.AppendLog("track received", "label", track.StreamID(), "id", track.ID())
peerId, _ := rtc.UnpackTrackId(track.ID()) r := rtc.NewReceiver(nil, rtpReceiver, track)
r := rtc.NewReceiver(peerId, rtpReceiver, nil)
c.lock.Lock() c.lock.Lock()
c.receivers = append(c.receivers, r) c.receivers = append(c.receivers, r)
r.Start() go c.consumeReceiver(track.ID(), r)
go c.consumeReceiver(r)
c.lock.Unlock() c.lock.Unlock()
}) })
peerConn.OnNegotiationNeeded(func() { peerConn.OnNegotiationNeeded(func() {
c.AppendLog("negotiate needed") // do nothing
if !c.connected { //c.AppendLog("negotiate needed")
c.AppendLog("not yet connected, skipping negotiate") //if !c.connected {
return // c.AppendLog("not yet connected, skipping negotiate")
} // return
err := c.Negotiate() //}
if err != nil { //err := c.Negotiate()
c.AppendLog("error negotiating", "err", err) //if err != nil {
} // c.AppendLog("error negotiating", "err", err)
//}
}) })
peerConn.OnDataChannel(func(channel *webrtc.DataChannel) { peerConn.OnDataChannel(func(channel *webrtc.DataChannel) {
@@ -218,11 +219,11 @@ func (c *RTCClient) Run() error {
} }
c.pendingCandidates = nil c.pendingCandidates = nil
c.lock.Unlock() c.lock.Unlock()
case *livekit.SignalResponse_Negotiate: case *livekit.SignalResponse_Offer:
c.AppendLog("received negotiate", c.AppendLog("received server offer",
"type", msg.Negotiate.Type) "type", msg.Offer.Type)
desc := rtc.FromProtoSessionDescription(msg.Negotiate) desc := rtc.FromProtoSessionDescription(msg.Offer)
if err := c.handleNegotiate(desc); err != nil { if err := c.handleOffer(desc); err != nil {
return err return err
} }
case *livekit.SignalResponse_Trickle: case *livekit.SignalResponse_Trickle:
@@ -313,31 +314,7 @@ func (c *RTCClient) SendIceCandidate(ic *webrtc.ICECandidate) error {
}) })
} }
func (c *RTCClient) Negotiate() error { func (c *RTCClient) handleOffer(desc webrtc.SessionDescription) error {
// Create an offer to send to the other process
offer, err := c.PeerConn.CreateOffer(nil)
if err != nil {
return err
}
if err = c.PeerConn.SetLocalDescription(offer); err != nil {
return err
}
// send the offer to remote
req := &livekit.SignalRequest{
Message: &livekit.SignalRequest_Negotiate{
Negotiate: rtc.ToProtoSessionDescription(offer),
},
}
c.AppendLog("sending negotiate offer to remote...")
if err = c.SendRequest(req); err != nil {
return err
}
return nil
}
func (c *RTCClient) handleNegotiate(desc webrtc.SessionDescription) error {
// always set remote description for both offer and answer // always set remote description for both offer and answer
if err := c.PeerConn.SetRemoteDescription(desc); err != nil { if err := c.PeerConn.SetRemoteDescription(desc); err != nil {
return err return err
@@ -362,8 +339,8 @@ func (c *RTCClient) handleNegotiate(desc webrtc.SessionDescription) error {
// send remote an answer // send remote an answer
return c.SendRequest(&livekit.SignalRequest{ return c.SendRequest(&livekit.SignalRequest{
Message: &livekit.SignalRequest_Negotiate{ Message: &livekit.SignalRequest_Answer{
Negotiate: rtc.ToProtoSessionDescription(answer), Answer: rtc.ToProtoSessionDescription(answer),
}, },
}) })
} }
@@ -407,6 +384,26 @@ func (c *RTCClient) AddTrack(path string, id string, label string) error {
c.pendingTrackWriters = append(c.pendingTrackWriters, tw) c.pendingTrackWriters = append(c.pendingTrackWriters, tw)
return nil return nil
} }
trackType := livekit.TrackType_AUDIO
if strings.HasPrefix(mime, "video") {
trackType = livekit.TrackType_VIDEO
}
return c.SendAddTrack(id, label, trackType)
}
// send AddTrack command to server to initiate server-side negotiation
func (c *RTCClient) SendAddTrack(cid string, name string, trackType livekit.TrackType) error {
return c.SendRequest(&livekit.SignalRequest{
Message: &livekit.SignalRequest_AddTrack{
AddTrack: &livekit.AddTrackRequest{
Cid: cid,
Name: name,
Type: trackType,
},
},
})
} }
type logEntry struct { type logEntry struct {
@@ -446,16 +443,11 @@ func (c *RTCClient) logLoop() {
} }
} }
func (c *RTCClient) consumeReceiver(r *rtc.ReceiverImpl) { func (c *RTCClient) consumeReceiver(trackId string, r types.Receiver) {
lastUpdate := time.Time{} lastUpdate := time.Time{}
peerId, trackId := rtc.UnpackTrackId(r.TrackId()) peerId, trackId := rtc.UnpackTrackId(trackId)
numBytes := 0 numBytes := 0
for { for pkt := range r.RTPChan() {
pkt, err := r.ReadRTP()
if rtc.IsEOF(err) {
// all done
return
}
numBytes += pkt.MarshalSize() numBytes += pkt.MarshalSize()
if time.Now().Sub(lastUpdate) > 30*time.Second { if time.Now().Sub(lastUpdate) > 30*time.Second {
c.AppendLog("consumed from peer", c.AppendLog("consumed from peer",
+3 -1
View File
@@ -6,6 +6,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"time"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
@@ -61,6 +62,7 @@ func accessToken(c *cli.Context, grant *auth.VideoGrant, identity string) (value
at := auth.NewAccessToken(apiKey, apiSecret). at := auth.NewAccessToken(apiKey, apiSecret).
AddGrant(grant). AddGrant(grant).
SetIdentity(identity) SetIdentity(identity).
SetValidFor(time.Hour * 24)
return at.ToJWT() return at.ToJWT()
} }
+10 -6
View File
@@ -5,6 +5,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"math/rand"
"net" "net"
"net/http" "net/http"
"os" "os"
@@ -66,6 +67,8 @@ func main() {
} }
func startServer(c *cli.Context) error { func startServer(c *cli.Context) error {
rand.Seed(time.Now().UnixNano())
conf, err := config.NewConfig(c.String("config")) conf, err := config.NewConfig(c.String("config"))
if err != nil { if err != nil {
return err return err
@@ -78,14 +81,15 @@ func startServer(c *cli.Context) error {
logger.InitDevelopment() logger.InitDevelopment()
} else { } else {
logger.InitProduction() logger.InitProduction()
// require a key provider
if keyProvider, err = createKeyProvider(c.String("key-file"), c.String("keys")); err != nil {
return err
}
service.AuthRequired = true
logger.GetLogger().Infow("auth enabled", "num_keys", keyProvider.NumKeys())
} }
// require a key provider
if keyProvider, err = createKeyProvider(c.String("key-file"), c.String("keys")); err != nil {
return err
}
service.AuthRequired = true
logger.GetLogger().Infow("auth enabled", "num_keys", keyProvider.NumKeys())
server, err := InitializeServer(conf, keyProvider) server, err := InitializeServer(conf, keyProvider)
if err != nil { if err != nil {
return err return err
+6 -6
View File
@@ -3,8 +3,9 @@ module github.com/livekit/livekit-server
go 1.15 go 1.15
require ( require (
github.com/bep/debounce v1.2.0
github.com/gammazero/workerpool v1.1.1
github.com/golang/protobuf v1.4.3 github.com/golang/protobuf v1.4.3
github.com/google/uuid v1.1.2
github.com/google/wire v0.4.0 github.com/google/wire v0.4.0
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.4.2
github.com/lithammer/shortuuid/v3 v3.0.4 github.com/lithammer/shortuuid/v3 v3.0.4
@@ -13,14 +14,13 @@ require (
github.com/magefile/mage v1.10.0 github.com/magefile/mage v1.10.0
github.com/manifoldco/promptui v0.8.0 github.com/manifoldco/promptui v0.8.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0 github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
github.com/pion/interceptor v0.0.5
github.com/pion/ion-log v1.0.0 github.com/pion/ion-log v1.0.0
github.com/pion/ion-sfu v1.6.5 github.com/pion/ion-sfu v1.7.2
github.com/pion/rtcp v1.2.6 github.com/pion/rtcp v1.2.6
github.com/pion/rtp v1.6.1 github.com/pion/rtp v1.6.2
github.com/pion/sdp/v3 v3.0.3
github.com/pion/stun v0.3.5 github.com/pion/stun v0.3.5
github.com/pion/webrtc/v3 v3.0.0-beta.16 github.com/pion/transport v0.12.2
github.com/pion/webrtc/v3 v3.0.3
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.6.1 github.com/stretchr/testify v1.6.1
github.com/thoas/go-funk v0.7.0 github.com/thoas/go-funk v0.7.0
+28 -27
View File
@@ -39,6 +39,7 @@ github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZw
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bep/debounce v1.2.0 h1:wXds8Kq8qRfwAOpAxHrJDbCXgC5aHSzgQb/0gKsHQqo=
github.com/bep/debounce v1.2.0/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0= github.com/bep/debounce v1.2.0/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
@@ -92,8 +93,11 @@ github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2
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 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
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=
github.com/gammazero/deque v0.0.0-20200721202602-07291166fe33/go.mod h1:D90+MBHVc9Sk1lJAbEVgws0eYEurY4mv2TDso3Nxh3w=
github.com/gammazero/deque v0.0.0-20201010052221-3932da5530cc h1:F7BbnLACph7UYiz9ZHi6npcROwKaZUyviDjsNERsoMM= github.com/gammazero/deque v0.0.0-20201010052221-3932da5530cc h1:F7BbnLACph7UYiz9ZHi6npcROwKaZUyviDjsNERsoMM=
github.com/gammazero/deque v0.0.0-20201010052221-3932da5530cc/go.mod h1:IlBLfYXnuw9sspy1XS6ctu5exGb6WHGKQsyo4s7bOEA= github.com/gammazero/deque v0.0.0-20201010052221-3932da5530cc/go.mod h1:IlBLfYXnuw9sspy1XS6ctu5exGb6WHGKQsyo4s7bOEA=
github.com/gammazero/workerpool v1.1.1 h1:MN29GcZtZZAgzTU+Zk54Y+J9XkE54MoXON/NCZvNulo=
github.com/gammazero/workerpool v1.1.1/go.mod h1:5BN0IJVRjSFAypo9QTJCaWdijjNz9Jjl6VFS1PRjCeg=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
@@ -304,52 +308,47 @@ github.com/pion/datachannel v1.4.21 h1:3ZvhNyfmxsAqltQrApLPQMhSFNA+aT87RqyCq4OXm
github.com/pion/datachannel v1.4.21/go.mod h1:oiNyP4gHx2DIwRzX/MFyH0Rz/Gz05OgBlayAI2hAWjg= github.com/pion/datachannel v1.4.21/go.mod h1:oiNyP4gHx2DIwRzX/MFyH0Rz/Gz05OgBlayAI2hAWjg=
github.com/pion/dtls/v2 v2.0.4 h1:WuUcqi6oYMu/noNTz92QrF1DaFj4eXbhQ6dzaaAwOiI= github.com/pion/dtls/v2 v2.0.4 h1:WuUcqi6oYMu/noNTz92QrF1DaFj4eXbhQ6dzaaAwOiI=
github.com/pion/dtls/v2 v2.0.4/go.mod h1:qAkFscX0ZHoI1E07RfYPoRw3manThveu+mlTDdOxoGI= github.com/pion/dtls/v2 v2.0.4/go.mod h1:qAkFscX0ZHoI1E07RfYPoRw3manThveu+mlTDdOxoGI=
github.com/pion/ice/v2 v2.0.13 h1:lVe7g86tQ0vKdH430hQR/t7zV1oeXbK75130TUArrnw=
github.com/pion/ice/v2 v2.0.13/go.mod h1:mZlypgoynMn2ayhGsjrPY/G/WiRiYO8WCPC6gUeg1RA=
github.com/pion/ice/v2 v2.0.14 h1:FxXxauyykf89SWAtkQCfnHkno6G8+bhRkNguSh9zU+4= github.com/pion/ice/v2 v2.0.14 h1:FxXxauyykf89SWAtkQCfnHkno6G8+bhRkNguSh9zU+4=
github.com/pion/ice/v2 v2.0.14/go.mod h1:wqaUbOq5ObDNU5ox1hRsEst0rWfsKuH1zXjQFEWiZwM= github.com/pion/ice/v2 v2.0.14/go.mod h1:wqaUbOq5ObDNU5ox1hRsEst0rWfsKuH1zXjQFEWiZwM=
github.com/pion/interceptor v0.0.5 h1:BOwlubM1lntji3eNaVrhW1Qk3u1UoemrhM4mbv24XGM= github.com/pion/interceptor v0.0.9 h1:fk5hTdyLO3KURQsf/+RjMpEm4NE3yeTY9Kh97b5BvwA=
github.com/pion/interceptor v0.0.5/go.mod h1:lPVrf5xfosI989ZcmgPS4WwwRhd+XAyTFaYI2wHf7nU= github.com/pion/interceptor v0.0.9/go.mod h1:dHgEP5dtxOTf21MObuBAjJeAayPxLUAZjerGH8Xr07c=
github.com/pion/ion-log v1.0.0 h1:2lJLImCmfCWCR38hLWsjQfBWe6NFz/htbqiYHwvOP/Q= github.com/pion/ion-log v1.0.0 h1:2lJLImCmfCWCR38hLWsjQfBWe6NFz/htbqiYHwvOP/Q=
github.com/pion/ion-log v1.0.0/go.mod h1:jwcla9KoB9bB/4FxYDSRJPcPYSLp5XiUUMnOLaqwl4E= github.com/pion/ion-log v1.0.0/go.mod h1:jwcla9KoB9bB/4FxYDSRJPcPYSLp5XiUUMnOLaqwl4E=
github.com/pion/ion-sfu v1.6.5 h1:L1V0eJ2hW0ox6LJAKBayOVaoHzQMIqKMP+kjS5IMp6Q= github.com/pion/ion-sfu v1.7.2 h1:jW59IxIQtcGotK/BYlTqOF1Vsp/UqM4BoRD6MMnYw1Y=
github.com/pion/ion-sfu v1.6.5/go.mod h1:1NUUIynUZuNjfnc/r7sjeI7RlVk+sq6q/sFnu8x9Sv8= github.com/pion/ion-sfu v1.7.2/go.mod h1:61HfTCWVx6rTpYCc7kmvnTToEpyBoMwDhOyvMiUtNhk=
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms=
github.com/pion/mdns v0.0.4 h1:O4vvVqr4DGX63vzmO6Fw9vpy3lfztVWHGCQfyw0ZLSY= github.com/pion/mdns v0.0.4 h1:O4vvVqr4DGX63vzmO6Fw9vpy3lfztVWHGCQfyw0ZLSY=
github.com/pion/mdns v0.0.4/go.mod h1:R1sL0p50l42S5lJs91oNdUL58nm0QHrhxnSegr++qC0= github.com/pion/mdns v0.0.4/go.mod h1:R1sL0p50l42S5lJs91oNdUL58nm0QHrhxnSegr++qC0=
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.4/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0=
github.com/pion/rtcp v1.2.6 h1:1zvwBbyd0TeEuuWftrd/4d++m+/kZSeiguxU61LFWpo= github.com/pion/rtcp v1.2.6 h1:1zvwBbyd0TeEuuWftrd/4d++m+/kZSeiguxU61LFWpo=
github.com/pion/rtcp v1.2.6/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0= github.com/pion/rtcp v1.2.6/go.mod h1:52rMNPWFsjr39z9B9MhnkqhPLoeHTv1aN63o/42bWE0=
github.com/pion/rtp v1.6.1 h1:2Y2elcVBrahYnHKN2X7rMHX/r1R4TEBMP1LaVu/wNhk= github.com/pion/rtp v1.6.2 h1:iGBerLX6JiDjB9NXuaPzHyxHFG9JsIEdgwTC0lp5n/U=
github.com/pion/rtp v1.6.1/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko= github.com/pion/rtp v1.6.2/go.mod h1:bDb5n+BFZxXx0Ea7E5qe+klMuqiBrP+w8XSjiWtCUko=
github.com/pion/sctp v1.7.10/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0= github.com/pion/sctp v1.7.10/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
github.com/pion/sctp v1.7.11 h1:UCnj7MsobLKLuP/Hh+JMiI/6W5Bs/VF45lWKgHFjSIE= github.com/pion/sctp v1.7.11 h1:UCnj7MsobLKLuP/Hh+JMiI/6W5Bs/VF45lWKgHFjSIE=
github.com/pion/sctp v1.7.11/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0= github.com/pion/sctp v1.7.11/go.mod h1:EhpTUQu1/lcK3xI+eriS6/96fWetHGCvBi9MSsnaBN0=
github.com/pion/sdp/v3 v3.0.3 h1:gJK9hk+JFD2NGIM1nXmqNCq1DkVaIZ9dlA3u3otnkaw= github.com/pion/sdp/v3 v3.0.3 h1:gJK9hk+JFD2NGIM1nXmqNCq1DkVaIZ9dlA3u3otnkaw=
github.com/pion/sdp/v3 v3.0.3/go.mod h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk= github.com/pion/sdp/v3 v3.0.3/go.mod h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk=
github.com/pion/srtp/v2 v2.0.0-rc.3 h1:1fPiK1nJlNyh235tSGgBnXrPc99wK1/D707f6ntb3qY= github.com/pion/srtp/v2 v2.0.1 h1:kgfh65ob3EcnFYA4kUBvU/menCp9u7qaJLXwWgpobzs=
github.com/pion/srtp/v2 v2.0.0-rc.3/go.mod h1:S6J9oY6ahAXdU3ni4nUwhWTJuBfssFjPxoB0u41TBpY= github.com/pion/srtp/v2 v2.0.1/go.mod h1:c8NWHhhkFf/drmHTAblkdu8++lsISEBBdAuiyxgqIsE=
github.com/pion/stun v0.3.5 h1:uLUCBCkQby4S1cf6CGuR9QrVOKcvUwFeemaC865QHDg= github.com/pion/stun v0.3.5 h1:uLUCBCkQby4S1cf6CGuR9QrVOKcvUwFeemaC865QHDg=
github.com/pion/stun v0.3.5/go.mod h1:gDMim+47EeEtfWogA37n6qXZS88L5V6LqFcf+DZA2UA= github.com/pion/stun v0.3.5/go.mod h1:gDMim+47EeEtfWogA37n6qXZS88L5V6LqFcf+DZA2UA=
github.com/pion/transport v0.8.10/go.mod h1:tBmha/UCjpum5hqTWhfAEs3CO4/tHSg0MYRhSzR+CZ8= github.com/pion/transport v0.8.10/go.mod h1:tBmha/UCjpum5hqTWhfAEs3CO4/tHSg0MYRhSzR+CZ8=
github.com/pion/transport v0.10.0/go.mod h1:BnHnUipd0rZQyTVB2SBGojFHT9CBt5C5TcsJSQGkvSE= github.com/pion/transport v0.10.0/go.mod h1:BnHnUipd0rZQyTVB2SBGojFHT9CBt5C5TcsJSQGkvSE=
github.com/pion/transport v0.10.1 h1:2W+yJT+0mOQ160ThZYUx5Zp2skzshiNgxrNE9GUfhJM= github.com/pion/transport v0.10.1 h1:2W+yJT+0mOQ160ThZYUx5Zp2skzshiNgxrNE9GUfhJM=
github.com/pion/transport v0.10.1/go.mod h1:PBis1stIILMiis0PewDw91WJeLJkyIMcEk+DwKOzf4A= github.com/pion/transport v0.10.1/go.mod h1:PBis1stIILMiis0PewDw91WJeLJkyIMcEk+DwKOzf4A=
github.com/pion/transport v0.11.0/go.mod h1:ORH8Ouyl1enoJyHwU+MwMeQocWbeorEk5068FOsHjog=
github.com/pion/transport v0.12.0 h1:UFmOBBZkTZ3LgvLRf/NGrfWdZEubcU6zkLU3PsA9YvU= github.com/pion/transport v0.12.0 h1:UFmOBBZkTZ3LgvLRf/NGrfWdZEubcU6zkLU3PsA9YvU=
github.com/pion/transport v0.12.0/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q= github.com/pion/transport v0.12.0/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q=
github.com/pion/transport v0.12.2 h1:WYEjhloRHt1R86LhUKjC5y+P52Y11/QqEUalvtzVoys=
github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q=
github.com/pion/turn/v2 v2.0.5 h1:iwMHqDfPEDEOFzwWKT56eFmh6DYC6o/+xnLAEzgISbA= github.com/pion/turn/v2 v2.0.5 h1:iwMHqDfPEDEOFzwWKT56eFmh6DYC6o/+xnLAEzgISbA=
github.com/pion/turn/v2 v2.0.5/go.mod h1:APg43CFyt/14Uy7heYUOGWdkem/Wu4PhCO/bjyrTqMw= github.com/pion/turn/v2 v2.0.5/go.mod h1:APg43CFyt/14Uy7heYUOGWdkem/Wu4PhCO/bjyrTqMw=
github.com/pion/udp v0.1.0 h1:uGxQsNyrqG3GLINv36Ff60covYmfrLoxzwnCsIYspXI= github.com/pion/udp v0.1.0 h1:uGxQsNyrqG3GLINv36Ff60covYmfrLoxzwnCsIYspXI=
github.com/pion/udp v0.1.0/go.mod h1:BPELIjbwE9PRbd/zxI/KYBnbo7B6+oA6YuEaNE8lths= github.com/pion/udp v0.1.0/go.mod h1:BPELIjbwE9PRbd/zxI/KYBnbo7B6+oA6YuEaNE8lths=
github.com/pion/webrtc/v3 v3.0.0-beta.15.0.20201209023348-63401a8837fb h1:odlj6CPofUlcqGpFZyRbCCBHEv9WJaPWUIqO/IPiTuk= github.com/pion/webrtc/v3 v3.0.3 h1:nAXJ5niRFRRMneuhM56xsh3J76sv+HAHCNuBmab3YR0=
github.com/pion/webrtc/v3 v3.0.0-beta.15.0.20201209023348-63401a8837fb/go.mod h1:549ITPqIAp16O7ZtSRPAhj+CSteoM3Yjcb5xpDoT3vY= github.com/pion/webrtc/v3 v3.0.3/go.mod h1:DZonLDfkjMlsY/IGixAbcq8izHu0zJIk04DYx51KUvk=
github.com/pion/webrtc/v3 v3.0.0-beta.16 h1:0z4vYmw423qF6/qKXMFc8aAyPC8PKe9m2RLvpqlJDvI=
github.com/pion/webrtc/v3 v3.0.0-beta.16/go.mod h1:HsPeqc1J+fz3FZx3ZIGc43m0uVdktfF+rvJaxXWny1M=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -364,7 +363,7 @@ github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDf
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= github.com/prometheus/client_golang v1.9.0/go.mod h1:FqZLKOZnGdFAhOK4nqGHa7D66IdsO+O441Eve7ptJDU=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -377,7 +376,7 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@@ -478,8 +477,8 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= 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-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -533,8 +532,8 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102 h1:42cLlJJdEh+ySyeUUbEQ5bsTi
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7 h1:3uJsdck53FDIpWwLeAXlia9p4C8j0BO2xZrqzKpL0D8= golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7 h1:3uJsdck53FDIpWwLeAXlia9p4C8j0BO2xZrqzKpL0D8=
golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7/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-20201207224615-747e23833adb h1:xj2oMIbduz83x7tzglytWT7spn6rP+9hvKjTpro6/pM= golang.org/x/net v0.0.0-20201224014010-6772e930b67b h1:iFwSg7t5GZmB/Q5TjiEAsdoLDrdJRC1RiF2WhuV29Qw=
golang.org/x/net v0.0.0-20201207224615-747e23833adb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -545,8 +544,8 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/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-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/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=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -577,10 +576,12 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d h1:MiWWjyhUzZ+jvhZvloX6ZrUsdEghn8a64Upd8EMHglE= golang.org/x/sys v0.0.0-20201214210602-f9fddec55a1e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201207223542-d4d67f95c62d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201223074533-0d417f636930 h1:vRgIt+nup/B/BwIS0g2oC0haq0iqbV3ZA+u6+0TlNCo=
golang.org/x/sys v0.0.0-20201223074533-0d417f636930/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
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/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.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
+2
View File
@@ -74,6 +74,7 @@ func Proto() error {
"proto/room.proto", "proto/room.proto",
"proto/model.proto", "proto/model.proto",
) )
connectStd(cmd)
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
return err return err
} }
@@ -86,6 +87,7 @@ func Proto() error {
"-I=proto", "-I=proto",
"proto/rtc.proto", "proto/rtc.proto",
) )
connectStd(cmd)
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
return err return err
} }
-8
View File
@@ -11,7 +11,6 @@ import (
type WebRTCConfig struct { type WebRTCConfig struct {
Configuration webrtc.Configuration Configuration webrtc.Configuration
SettingEngine webrtc.SettingEngine SettingEngine webrtc.SettingEngine
feedbackTypes []webrtc.RTCPFeedback
receiver ReceiverConfig receiver ReceiverConfig
} }
@@ -26,12 +25,6 @@ func NewWebRTCConfig(conf *config.RTCConfig, externalIP string) (*WebRTCConfig,
SDPSemantics: webrtc.SDPSemanticsUnifiedPlan, SDPSemantics: webrtc.SDPSemanticsUnifiedPlan,
} }
s := webrtc.SettingEngine{} s := webrtc.SettingEngine{}
ft := []webrtc.RTCPFeedback{
{Type: webrtc.TypeRTCPFBCCM},
{Type: webrtc.TypeRTCPFBNACK},
{Type: webrtc.TypeRTCPFBGoogREMB},
{Type: "nack pli"},
}
if conf.ICEPortRangeStart != 0 && conf.ICEPortRangeEnd != 0 { if conf.ICEPortRangeStart != 0 && conf.ICEPortRangeEnd != 0 {
if err := s.SetEphemeralUDPPortRange(conf.ICEPortRangeStart, conf.ICEPortRangeEnd); err != nil { if err := s.SetEphemeralUDPPortRange(conf.ICEPortRangeStart, conf.ICEPortRangeEnd); err != nil {
@@ -55,7 +48,6 @@ func NewWebRTCConfig(conf *config.RTCConfig, externalIP string) (*WebRTCConfig,
return &WebRTCConfig{ return &WebRTCConfig{
Configuration: c, Configuration: c,
SettingEngine: s, SettingEngine: s,
feedbackTypes: ft,
receiver: ReceiverConfig{ receiver: ReceiverConfig{
maxBandwidth: conf.MaxBandwidth, maxBandwidth: conf.MaxBandwidth,
maxBufferTime: conf.MaxBufferTime, maxBufferTime: conf.MaxBufferTime,
+10 -4
View File
@@ -19,6 +19,7 @@ const (
// it shall forward publishedTracks to all of its subscribers // it shall forward publishedTracks to all of its subscribers
type DataTrack struct { type DataTrack struct {
id string id string
name string
participantId string participantId string
dataChannel *webrtc.DataChannel dataChannel *webrtc.DataChannel
lock sync.RWMutex lock sync.RWMutex
@@ -33,6 +34,7 @@ func NewDataTrack(participantId string, dc *webrtc.DataChannel) *DataTrack {
t := &DataTrack{ t := &DataTrack{
//ctx: context.Background(), //ctx: context.Background(),
id: utils.NewGuid(utils.TrackPrefix), id: utils.NewGuid(utils.TrackPrefix),
name: dc.Label(),
participantId: participantId, participantId: participantId,
dataChannel: dc, dataChannel: dc,
msgChan: make(chan livekit.DataMessage, dataBufferSize), msgChan: make(chan livekit.DataMessage, dataBufferSize),
@@ -58,12 +60,16 @@ func (t *DataTrack) ID() string {
return t.id return t.id
} }
func (t *DataTrack) Kind() livekit.TrackInfo_Type { func (t *DataTrack) Kind() livekit.TrackType {
return livekit.TrackInfo_DATA return livekit.TrackType_DATA
} }
func (t *DataTrack) StreamID() string { func (t *DataTrack) Name() string {
return t.dataChannel.Label() return t.name
}
func (t *DataTrack) SetName(name string) {
t.name = name
} }
// DataTrack cannot be muted // DataTrack cannot be muted
+1
View File
@@ -7,4 +7,5 @@ var (
ErrInvalidRoomName = errors.New("room must have a unique name") ErrInvalidRoomName = errors.New("room must have a unique name")
ErrRoomNotFound = errors.New("requested room does not exist") ErrRoomNotFound = errors.New("requested room does not exist")
ErrPermissionDenied = errors.New("no permissions to access the room") ErrPermissionDenied = errors.New("no permissions to access the room")
ErrUnexpectedOffer = errors.New("expected answer SDP, received offer")
) )
+21
View File
@@ -0,0 +1,21 @@
package rtc
import (
"sync"
"github.com/pion/ion-sfu/pkg/buffer"
)
const (
rtpPacketMaxSize = 1460
)
// package level factories for buffers
var (
bufferFactory = buffer.NewBufferFactory()
packetFactory = &sync.Pool{
New: func() interface{} {
return make([]byte, rtpPacketMaxSize)
},
}
)
-170
View File
@@ -1,170 +0,0 @@
package rtc
import (
"context"
"io"
"sync"
"time"
"github.com/pion/rtcp"
"github.com/pion/rtp"
"github.com/livekit/livekit-server/pkg/logger"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu"
)
type SimpleForwarder struct {
ctx context.Context
cancel context.CancelFunc
sourceRtcpCh chan []rtcp.Packet // channel to write RTCP packets to source
track *sfu.DownTrack // sender track
packetBuffer types.PacketBuffer
lastPli time.Time
createdAt time.Time
once sync.Once
// handlers
onClose func(forwarder types.Forwarder)
}
func NewSimpleForwarder(ctx context.Context, rtcpCh chan []rtcp.Packet, track *sfu.DownTrack, pb types.PacketBuffer) *SimpleForwarder {
ctx, cancel := context.WithCancel(ctx)
f := &SimpleForwarder{
ctx: ctx,
cancel: cancel,
sourceRtcpCh: rtcpCh,
packetBuffer: pb,
track: track,
createdAt: time.Now(),
}
// when underlying track is closed, close the forwarder too
track.OnCloseHandler(f.Close)
return f
}
func (f *SimpleForwarder) Start() {
f.once.Do(func() {
defer func() {
recover()
}()
go f.rtcpWorker()
})
}
func (f *SimpleForwarder) Close() {
if f.ctx.Err() != nil {
return
}
f.cancel()
if f.onClose != nil {
f.onClose(f)
}
}
// Writes an RTP packet to peer
func (f *SimpleForwarder) WriteRTP(pkt *rtp.Packet) error {
if f.ctx.Err() != nil {
// skip canceled context errors
return nil
}
err := f.track.WriteRTP(pkt)
if err != nil {
if err == io.ErrClosedPipe {
// TODO: log and error? how should this error be handled
return nil
}
return err
}
return nil
}
func (f *SimpleForwarder) OnClose(closeFunc func(types.Forwarder)) {
f.onClose = closeFunc
}
func (f *SimpleForwarder) CreatedAt() time.Time {
return f.createdAt
}
func (f *SimpleForwarder) Track() *sfu.DownTrack {
return f.track
}
// rtcpWorker receives RTCP packets from the destination peer
// this include packet loss packets
func (f *SimpleForwarder) rtcpWorker() {
for {
pkts, err := f.track.RTPSender().ReadRTCP()
if err == io.ErrClosedPipe || err == io.EOF {
f.Close()
return
}
if f.ctx.Err() != nil {
return
}
if err != nil {
logger.GetLogger().Errorw("could not write read RTCP",
"err", err)
continue
}
var fwdPkts []rtcp.Packet
pliOnce := true
firOnce := true
for _, pkt := range pkts {
switch p := pkt.(type) {
case *rtcp.PictureLossIndication:
if pliOnce {
p.MediaSSRC = f.track.LastSSRC()
p.SenderSSRC = f.track.SSRC()
fwdPkts = append(fwdPkts, p)
pliOnce = false
}
case *rtcp.FullIntraRequest:
if firOnce {
p.MediaSSRC = f.track.LastSSRC()
p.SenderSSRC = f.track.SSRC()
fwdPkts = append(fwdPkts, p)
firOnce = false
}
case *rtcp.ReceiverReport:
if len(p.Reports) > 0 && p.Reports[0].FractionLost > 25 {
//log.Tracef("Slow link for sender %s, fraction packet lost %.2f", f.track.peerID, float64(p.Reports[0].FractionLost)/256)
}
case *rtcp.TransportLayerNack:
logger.GetLogger().Debugw("forwarder got nack",
"packet", p)
for _, pair := range p.Nacks {
bufferedPackets := f.packetBuffer.GetBufferedPackets(
f.track.SSRC(),
f.track.SnOffset(),
f.track.TsOffset(),
f.track.GetNACKSeqNo(pair.PacketList()),
)
for i, _ := range bufferedPackets {
pt := bufferedPackets[i]
f.track.WriteRTP(&rtp.Packet{Header: pt.Header, Payload: pt.Payload})
}
}
default:
// TODO: Use fb packets for congestion control
}
}
if f.ctx.Err() != nil {
return
}
if len(fwdPkts) > 0 {
f.sourceRtcpCh <- fwdPkts
}
}
}
+2 -2
View File
@@ -15,10 +15,10 @@ func newMockParticipant(name string) *typesfakes.FakeParticipant {
return p return p
} }
func newMockTrack(kind livekit.TrackInfo_Type, name string) *typesfakes.FakePublishedTrack { func newMockTrack(kind livekit.TrackType, name string) *typesfakes.FakePublishedTrack {
t := &typesfakes.FakePublishedTrack{} t := &typesfakes.FakePublishedTrack{}
t.IDReturns(utils.NewGuid(utils.TrackPrefix)) t.IDReturns(utils.NewGuid(utils.TrackPrefix))
t.KindReturns(kind) t.KindReturns(kind)
t.StreamIDReturns(name) t.NameReturns(name)
return t return t
} }
+110 -51
View File
@@ -2,10 +2,14 @@ package rtc
import ( import (
"context" "context"
"io"
"sync" "sync"
"time" "time"
"github.com/gammazero/workerpool"
"github.com/pion/ion-sfu/pkg/buffer"
"github.com/pion/rtcp" "github.com/pion/rtcp"
"github.com/pion/transport/packetio"
"github.com/pion/webrtc/v3" "github.com/pion/webrtc/v3"
"github.com/pion/webrtc/v3/pkg/rtcerr" "github.com/pion/webrtc/v3/pkg/rtcerr"
@@ -18,7 +22,11 @@ import (
var ( var (
maxPLIFrequency = 1 * time.Second maxPLIFrequency = 1 * time.Second
feedbackTypes = []webrtc.RTCPFeedback{{"goog-remb", ""}, {"nack", ""}, {"nack", "pli"}} feedbackTypes = []webrtc.RTCPFeedback{
{webrtc.TypeRTCPFBGoogREMB, ""},
{webrtc.TypeRTCPFBTransportCC, ""},
{webrtc.TypeRTCPFBNACK, ""},
{webrtc.TypeRTCPFBNACK, "pli"}}
) )
// MediaTrack represents a WebRTC track that needs to be forwarded // MediaTrack represents a WebRTC track that needs to be forwarded
@@ -29,19 +37,19 @@ type MediaTrack struct {
participantId string participantId string
muted bool muted bool
// duplicated properties from TrackRemote ssrc webrtc.SSRC
ssrc webrtc.SSRC name string
streamID string // otherwise known as label kind livekit.TrackType
kind livekit.TrackInfo_Type codec webrtc.RTPCodecParameters
codec webrtc.RTPCodecParameters
// channel to send RTCP packets to the source // channel to send RTCP packets to the source
rtcpCh chan []rtcp.Packet rtcpCh chan []rtcp.Packet
lock sync.RWMutex lock sync.RWMutex
once sync.Once once sync.Once
// map of target participantId -> forwarder // map of target participantId -> DownTrack
forwarders map[string]types.Forwarder downtracks map[string]types.DownTrack
receiver types.Receiver receiver types.Receiver
nackWorker *workerpool.WorkerPool
//lastNack int64 //lastNack int64
lastPLI time.Time lastPLI time.Time
} }
@@ -52,14 +60,15 @@ func NewMediaTrack(pId string, rtcpCh chan []rtcp.Packet, track *webrtc.TrackRem
id: utils.NewGuid(utils.TrackPrefix), id: utils.NewGuid(utils.TrackPrefix),
participantId: pId, participantId: pId,
ssrc: track.SSRC(), ssrc: track.SSRC(),
streamID: track.StreamID(), name: track.StreamID(),
kind: ToProtoTrackKind(track.Kind()), kind: ToProtoTrackKind(track.Kind()),
codec: track.Codec(), codec: track.Codec(),
rtcpCh: rtcpCh, rtcpCh: rtcpCh,
lock: sync.RWMutex{}, lock: sync.RWMutex{},
once: sync.Once{}, once: sync.Once{},
forwarders: make(map[string]types.Forwarder), downtracks: make(map[string]types.DownTrack),
receiver: receiver, receiver: receiver,
nackWorker: workerpool.New(1),
} }
return t return t
@@ -67,7 +76,6 @@ func NewMediaTrack(pId string, rtcpCh chan []rtcp.Packet, track *webrtc.TrackRem
func (t *MediaTrack) Start() { func (t *MediaTrack) Start() {
t.once.Do(func() { t.once.Do(func() {
t.receiver.Start()
// start worker // start worker
go t.forwardRTPWorker() go t.forwardRTPWorker()
}) })
@@ -77,12 +85,16 @@ func (t *MediaTrack) ID() string {
return t.id return t.id
} }
func (t *MediaTrack) Kind() livekit.TrackInfo_Type { func (t *MediaTrack) Kind() livekit.TrackType {
return t.kind return t.kind
} }
func (t *MediaTrack) StreamID() string { func (t *MediaTrack) Name() string {
return t.streamID return t.name
}
func (t *MediaTrack) SetName(name string) {
t.name = name
} }
func (t *MediaTrack) IsMuted() bool { func (t *MediaTrack) IsMuted() bool {
@@ -103,7 +115,7 @@ func (t *MediaTrack) AddSubscriber(participant types.Participant) error {
Channels: codec.Channels, Channels: codec.Channels,
SDPFmtpLine: codec.SDPFmtpLine, SDPFmtpLine: codec.SDPFmtpLine,
RTCPFeedback: feedbackTypes, RTCPFeedback: feedbackTypes,
}, packedId, t.StreamID()) }, packedId, t.Name())
if err != nil { if err != nil {
return err return err
} }
@@ -117,15 +129,17 @@ func (t *MediaTrack) AddSubscriber(participant types.Participant) error {
outTrack.SetTransceiver(transceiver) outTrack.SetTransceiver(transceiver)
// TODO: when outtrack is bound, start loop to send reports // TODO: when outtrack is bound, start loop to send reports
//outTrack.OnBind(func() { outTrack.OnBind(func() {
// go sub.sendStreamDownTracksReports(recv.StreamID()) if rr := bufferFactory.GetOrNew(packetio.RTCPBufferPacket, outTrack.SSRC()).(*buffer.RTCPReader); rr != nil {
//}) rr.OnPacket(func(pkt []byte) {
participant.AddDownTrack(t.StreamID(), outTrack) t.handleRTCP(outTrack, pkt)
})
forwarder := NewSimpleForwarder(t.ctx, t.rtcpCh, outTrack, t.receiver) }
forwarder.OnClose(func(f types.Forwarder) { //go sub.sendStreamDownTracksReports(recv.Name())
})
outTrack.OnCloseHandler(func() {
t.lock.Lock() t.lock.Lock()
delete(t.forwarders, participant.ID()) delete(t.downtracks, participant.ID())
t.lock.Unlock() t.lock.Unlock()
if participant.PeerConnection().ConnectionState() == webrtc.PeerConnectionStateClosed { if participant.PeerConnection().ConnectionState() == webrtc.PeerConnectionStateClosed {
@@ -142,15 +156,13 @@ func (t *MediaTrack) AddSubscriber(participant types.Participant) error {
} }
} }
participant.RemoveDownTrack(t.StreamID(), outTrack) participant.RemoveDownTrack(t.Name(), outTrack)
}) })
participant.AddDownTrack(t.Name(), outTrack)
t.lock.Lock() t.lock.Lock()
defer t.lock.Unlock() defer t.lock.Unlock()
t.forwarders[participant.ID()] = forwarder t.downtracks[participant.ID()] = outTrack
// start forwarder
forwarder.Start()
return nil return nil
} }
@@ -161,8 +173,8 @@ func (t *MediaTrack) RemoveSubscriber(participantId string) {
t.lock.RLock() t.lock.RLock()
defer t.lock.RUnlock() defer t.lock.RUnlock()
if forwarder := t.forwarders[participantId]; forwarder != nil { if dt := t.downtracks[participantId]; dt != nil {
go forwarder.Close() go dt.Close()
} }
} }
@@ -170,10 +182,10 @@ func (t *MediaTrack) RemoveAllSubscribers() {
logger.GetLogger().Debugw("removing all subscribers", "track", t.id) logger.GetLogger().Debugw("removing all subscribers", "track", t.id)
t.lock.RLock() t.lock.RLock()
defer t.lock.RUnlock() defer t.lock.RUnlock()
for _, f := range t.forwarders { for _, dt := range t.downtracks {
go f.Close() go dt.Close()
} }
t.forwarders = make(map[string]types.Forwarder) t.downtracks = make(map[string]types.DownTrack)
} }
// forwardRTPWorker reads from the receiver and writes to each sender // forwardRTPWorker reads from the receiver and writes to each sender
@@ -181,25 +193,13 @@ func (t *MediaTrack) forwardRTPWorker() {
defer func() { defer func() {
t.RemoveAllSubscribers() t.RemoveAllSubscribers()
// TODO: send unpublished events? // TODO: send unpublished events?
t.nackWorker.Stop()
}() }()
for { for pkt := range t.receiver.RTPChan() {
pkt, err := t.receiver.ReadRTP() // when track is muted, it's "disabled" on the client side, and will still be sending black frames
if IsEOF(err) { // when our metadata is updated as such, we shortcircuit forwarding of black frames
logger.GetLogger().Debugw("Track received EOF, closing",
"participant", t.participantId,
"track", t.id)
return
}
if err != nil {
logger.GetLogger().Errorw("error while reading RTP",
"participant", t.participantId,
"track", t.id)
}
if t.muted { if t.muted {
// short circuit when track is muted
continue continue
} }
@@ -207,8 +207,8 @@ func (t *MediaTrack) forwardRTPWorker() {
// "participantId", t.participantId, // "participantId", t.participantId,
// "remoteTrack", t.remoteTrack.ID()) // "remoteTrack", t.remoteTrack.ID())
t.lock.RLock() t.lock.RLock()
for dstId, forwarder := range t.forwarders { for dstId, dt := range t.downtracks {
err := forwarder.WriteRTP(pkt) err := dt.WriteRTP(pkt)
if IsEOF(err) { if IsEOF(err) {
// this participant unsubscribed, remove it // this participant unsubscribed, remove it
t.RemoveSubscriber(dstId) t.RemoveSubscriber(dstId)
@@ -240,3 +240,62 @@ func (t *MediaTrack) forwardRTPWorker() {
t.lock.RUnlock() t.lock.RUnlock()
} }
} }
func (t *MediaTrack) handleRTCP(dt *sfu.DownTrack, rtcpBuf []byte) {
pkts, err := rtcp.Unmarshal(rtcpBuf)
if err != nil {
logger.GetLogger().Warnw("could not decode RTCP packet", "err", err)
}
var fwdPkts []rtcp.Packet
// sufficient to send this only once
pliOnce := true
firOnce := true
for _, pkt := range pkts {
switch p := pkt.(type) {
case *rtcp.PictureLossIndication:
if pliOnce {
p.MediaSSRC = dt.LastSSRC()
p.SenderSSRC = dt.SSRC()
fwdPkts = append(fwdPkts, p)
pliOnce = false
}
case *rtcp.FullIntraRequest:
if firOnce {
p.MediaSSRC = dt.LastSSRC()
p.SenderSSRC = dt.SSRC()
fwdPkts = append(fwdPkts, p)
firOnce = false
}
case *rtcp.ReceiverReport:
if len(p.Reports) > 0 && p.Reports[0].FractionLost > 25 {
//log.Tracef("Slow link for sender %s, fraction packet lost %.2f", f.track.peerID, float64(p.Reports[0].FractionLost)/256)
}
case *rtcp.TransportLayerNack:
logger.GetLogger().Debugw("forwarder got nack",
"packet", p)
var nackedPackets []uint16
for _, pair := range p.Nacks {
nackedPackets = append(nackedPackets, dt.GetNACKSeqNo(pair.PacketList())...)
}
t.nackWorker.Submit(func() {
pktBuf := packetFactory.Get().([]byte)
for _, sn := range nackedPackets {
pkt, err := t.receiver.GetBufferedPacket(pktBuf, sn, dt.SnOffset())
if err == io.EOF {
break
} else if err != nil {
continue
}
// what about handling write errors such as no packet found
dt.WriteRTP(pkt)
}
packetFactory.Put(pktBuf)
})
}
}
if len(fwdPkts) > 0 {
t.rtcpCh <- fwdPkts
}
}
+33 -20
View File
@@ -2,11 +2,11 @@ package rtc
import ( import (
"context" "context"
"io"
"sync" "sync"
"testing" "testing"
"time" "time"
"github.com/gammazero/workerpool"
"github.com/pion/rtcp" "github.com/pion/rtcp"
"github.com/pion/rtp" "github.com/pion/rtp"
"github.com/pion/webrtc/v3" "github.com/pion/webrtc/v3"
@@ -27,30 +27,29 @@ func TestForwardRTP(t *testing.T) {
t.Run("ensure that forwarders are getting packets", func(t *testing.T) { t.Run("ensure that forwarders are getting packets", func(t *testing.T) {
mt := newMediaTrackWithReceiver() mt := newMediaTrackWithReceiver()
receiver := mt.receiver.(*typesfakes.FakeReceiver) receiver := mt.receiver.(*typesfakes.FakeReceiver)
packet := &rtp.Packet{} packet := rtp.Packet{}
receiver.ReadRTPReturnsOnCall(0, packet, nil) receiver.RTPChanReturns(packetGenerator(packet))
forwarder := &typesfakes.FakeForwarder{} dt := &typesfakes.FakeDownTrack{}
mt.forwarders["test"] = forwarder mt.downtracks["test"] = dt
mt.Start() mt.Start()
time.Sleep(testWaitDuration) time.Sleep(testWaitDuration)
assert.Equal(t, 2, receiver.ReadRTPCallCount(), "worker didn't call ReadRTP twice") assert.Equal(t, 1, dt.WriteRTPCallCount(), "WriteRTP wasn't called on Forwarder")
assert.Equal(t, 1, forwarder.WriteRTPCallCount(), "WriteRTP wasn't called on Forwarder") assert.EqualValues(t, packet, dt.WriteRTPArgsForCall(0))
assert.Equal(t, packet, forwarder.WriteRTPArgsForCall(0))
}) })
t.Run("muted tracks do not forward data", func(t *testing.T) { t.Run("muted tracks do not forward data", func(t *testing.T) {
mt := newMediaTrackWithReceiver() mt := newMediaTrackWithReceiver()
mt.muted = true mt.muted = true
forwarder := &typesfakes.FakeForwarder{} dt := &typesfakes.FakeDownTrack{}
mt.forwarders["test"] = forwarder mt.downtracks["test"] = dt
mt.Start() mt.Start()
time.Sleep(testWaitDuration) time.Sleep(testWaitDuration)
assert.Zero(t, forwarder.WriteRTPCallCount()) assert.Zero(t, dt.WriteRTPCallCount())
}) })
} }
@@ -58,9 +57,9 @@ func TestMissingKeyFrames(t *testing.T) {
t.Run("PLI packet is sent when forwarder misses keyframe", func(t *testing.T) { t.Run("PLI packet is sent when forwarder misses keyframe", func(t *testing.T) {
mt := newMediaTrackWithReceiver() mt := newMediaTrackWithReceiver()
forwarder := &typesfakes.FakeForwarder{} dt := &typesfakes.FakeDownTrack{}
mt.forwarders["test"] = forwarder mt.downtracks["test"] = dt
forwarder.WriteRTPReturns(sfu.ErrRequiresKeyFrame) dt.WriteRTPReturns(sfu.ErrRequiresKeyFrame)
mt.Start() mt.Start()
time.Sleep(testWaitDuration) time.Sleep(testWaitDuration)
@@ -77,21 +76,35 @@ func TestMissingKeyFrames(t *testing.T) {
// returns a receiver that reads a packet then returns EOF // returns a receiver that reads a packet then returns EOF
func newMediaTrackWithReceiver() *MediaTrack { func newMediaTrackWithReceiver() *MediaTrack {
packet := &rtp.Packet{} packet := rtp.Packet{}
receiver := &typesfakes.FakeReceiver{} receiver := &typesfakes.FakeReceiver{
receiver.ReadRTPReturnsOnCall(0, packet, nil) RTPChanStub: func() <-chan rtp.Packet {
receiver.ReadRTPReturnsOnCall(1, nil, io.EOF) return packetGenerator(packet)
},
}
return &MediaTrack{ return &MediaTrack{
ctx: context.Background(), ctx: context.Background(),
id: utils.NewGuid(utils.TrackPrefix), id: utils.NewGuid(utils.TrackPrefix),
participantId: "PAtest", participantId: "PAtest",
muted: false, muted: false,
kind: livekit.TrackInfo_VIDEO, kind: livekit.TrackType_VIDEO,
codec: webrtc.RTPCodecParameters{}, codec: webrtc.RTPCodecParameters{},
rtcpCh: make(chan []rtcp.Packet, 5), rtcpCh: make(chan []rtcp.Packet, 5),
lock: sync.RWMutex{}, lock: sync.RWMutex{},
once: sync.Once{}, once: sync.Once{},
forwarders: map[string]types.Forwarder{}, downtracks: map[string]types.DownTrack{},
receiver: receiver, receiver: receiver,
nackWorker: workerpool.New(1),
} }
} }
func packetGenerator(packets ...rtp.Packet) <-chan rtp.Packet {
pc := make(chan rtp.Packet)
go func() {
defer close(pc)
for _, p := range packets {
pc <- p
}
}()
return pc
}
+97 -80
View File
@@ -2,12 +2,12 @@ package rtc
import ( import (
"context" "context"
"fmt"
"io" "io"
"sync" "sync"
"time" "time"
"github.com/pion/interceptor" "github.com/bep/debounce"
"github.com/pion/ion-sfu/pkg/buffer"
"github.com/pion/rtcp" "github.com/pion/rtcp"
"github.com/pion/webrtc/v3" "github.com/pion/webrtc/v3"
"github.com/pkg/errors" "github.com/pkg/errors"
@@ -22,6 +22,7 @@ import (
const ( const (
placeholderDataChannel = "_private" placeholderDataChannel = "_private"
sdBatchSize = 20 sdBatchSize = 20
negotiationFrequency = 100 * time.Millisecond
) )
type ParticipantImpl struct { type ParticipantImpl struct {
@@ -33,11 +34,13 @@ type ParticipantImpl struct {
mediaEngine *webrtc.MediaEngine mediaEngine *webrtc.MediaEngine
name string name string
state livekit.ParticipantInfo_State state livekit.ParticipantInfo_State
bi *buffer.Interceptor
rtcpCh chan []rtcp.Packet rtcpCh chan []rtcp.Packet
subscribedTracks map[string][]*sfu.DownTrack subscribedTracks map[string][]*sfu.DownTrack
// publishedTracks that participant is publishing // publishedTracks that participant is publishing
publishedTracks map[string]types.PublishedTrack publishedTracks map[string]types.PublishedTrack
// client intended to publish, yet to be reconciled
pendingTracks map[string]*livekit.TrackInfo
debouncedNegotiate func(func())
lock sync.RWMutex lock sync.RWMutex
once sync.Once once sync.Once
@@ -45,7 +48,6 @@ type ParticipantImpl struct {
// callbacks & handlers // callbacks & handlers
onTrackPublished func(types.Participant, types.PublishedTrack) onTrackPublished func(types.Participant, types.PublishedTrack)
onTrackUpdated func(types.Participant, types.PublishedTrack) onTrackUpdated func(types.Participant, types.PublishedTrack)
onOffer func(webrtc.SessionDescription)
onICECandidate func(c *webrtc.ICECandidateInit) onICECandidate func(c *webrtc.ICECandidateInit)
onStateChange func(p types.Participant, oldState livekit.ParticipantInfo_State) onStateChange func(p types.Participant, oldState livekit.ParticipantInfo_State)
onClose func(types.Participant) onClose func(types.Participant)
@@ -54,7 +56,10 @@ type ParticipantImpl struct {
func NewPeerConnection(conf *WebRTCConfig) (*webrtc.PeerConnection, error) { func NewPeerConnection(conf *WebRTCConfig) (*webrtc.PeerConnection, error) {
me := &webrtc.MediaEngine{} me := &webrtc.MediaEngine{}
me.RegisterDefaultCodecs() me.RegisterDefaultCodecs()
api := webrtc.NewAPI(webrtc.WithMediaEngine(me), webrtc.WithSettingEngine(conf.SettingEngine)) se := conf.SettingEngine
se.BufferFactory = bufferFactory.GetOrNew
api := webrtc.NewAPI(webrtc.WithMediaEngine(me), webrtc.WithSettingEngine(se))
return api.NewPeerConnection(conf.Configuration) return api.NewPeerConnection(conf.Configuration)
} }
@@ -62,29 +67,26 @@ func NewParticipant(pc types.PeerConnection, sc types.SignalConnection, name str
me := &webrtc.MediaEngine{} me := &webrtc.MediaEngine{}
me.RegisterDefaultCodecs() me.RegisterDefaultCodecs()
bi := buffer.NewBufferInterceptor()
ir := &interceptor.Registry{}
ir.Add(bi)
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
participant := &ParticipantImpl{ participant := &ParticipantImpl{
id: utils.NewGuid(utils.ParticipantPrefix), id: utils.NewGuid(utils.ParticipantPrefix),
name: name, name: name,
peerConn: pc, peerConn: pc,
sigConn: sc, sigConn: sc,
ctx: ctx, ctx: ctx,
cancel: cancel, cancel: cancel,
bi: bi, rtcpCh: make(chan []rtcp.Packet, 10),
rtcpCh: make(chan []rtcp.Packet, 10), subscribedTracks: make(map[string][]*sfu.DownTrack),
subscribedTracks: make(map[string][]*sfu.DownTrack), state: livekit.ParticipantInfo_JOINING,
state: livekit.ParticipantInfo_JOINING, lock: sync.RWMutex{},
lock: sync.RWMutex{}, publishedTracks: make(map[string]types.PublishedTrack, 0),
publishedTracks: make(map[string]types.PublishedTrack, 0), pendingTracks: make(map[string]*livekit.TrackInfo),
mediaEngine: me, mediaEngine: me,
debouncedNegotiate: debounce.New(negotiationFrequency),
} }
log := logger.GetLogger() log := logger.GetLogger()
pc.ConnectionState()
pc.OnTrack(participant.onMediaTrack) pc.OnTrack(participant.onMediaTrack)
pc.OnICECandidate(func(c *webrtc.ICECandidate) { pc.OnICECandidate(func(c *webrtc.ICECandidate) {
@@ -95,6 +97,7 @@ func NewParticipant(pc types.PeerConnection, sc types.SignalConnection, name str
ci := c.ToJSON() ci := c.ToJSON()
// write candidate // write candidate
logger.GetLogger().Debugw("sending ice candidates")
err := sc.WriteResponse(&livekit.SignalResponse{ err := sc.WriteResponse(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Trickle{ Message: &livekit.SignalResponse_Trickle{
Trickle: ToProtoTrickle(ci), Trickle: ToProtoTrickle(ci),
@@ -152,10 +155,6 @@ func (p *ParticipantImpl) OnTrackPublished(callback func(types.Participant, type
p.onTrackPublished = callback p.onTrackPublished = callback
} }
func (p *ParticipantImpl) OnOffer(callback func(webrtc.SessionDescription)) {
p.onOffer = callback
}
func (p *ParticipantImpl) OnICECandidate(callback func(c *webrtc.ICECandidateInit)) { func (p *ParticipantImpl) OnICECandidate(callback func(c *webrtc.ICECandidateInit)) {
p.onICECandidate = callback p.onICECandidate = callback
} }
@@ -172,7 +171,7 @@ func (p *ParticipantImpl) OnClose(callback func(types.Participant)) {
p.onClose = callback p.onClose = callback
} }
// Answer an offer from remote participant // Answer an offer from remote participant, used when clients make the initial connection
func (p *ParticipantImpl) Answer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error) { func (p *ParticipantImpl) Answer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error) {
if err = p.peerConn.SetRemoteDescription(sdp); err != nil { if err = p.peerConn.SetRemoteDescription(sdp); err != nil {
return return
@@ -192,32 +191,7 @@ func (p *ParticipantImpl) Answer(sdp webrtc.SessionDescription) (answer webrtc.S
// only set after answered // only set after answered
p.peerConn.OnNegotiationNeeded(func() { p.peerConn.OnNegotiationNeeded(func() {
logger.GetLogger().Debugw("negotiation needed", "participantId", p.ID()) logger.GetLogger().Debugw("negotiation needed", "participantId", p.ID())
offer, err := p.peerConn.CreateOffer(nil) p.scheduleNegotiate()
if err != nil {
logger.GetLogger().Errorw("could not create offer", "err", err)
return
}
err = p.peerConn.SetLocalDescription(offer)
if err != nil {
logger.GetLogger().Errorw("could not set local description", "err", err)
return
}
logger.GetLogger().Debugw("sending available offer to participant")
err = p.sigConn.WriteResponse(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Negotiate{
Negotiate: ToProtoSessionDescription(offer),
},
})
if err != nil {
logger.GetLogger().Errorw("could not send offer to peer",
"err", err)
}
if p.onOffer != nil {
p.onOffer(offer)
}
}) })
err = p.sigConn.WriteResponse(&livekit.SignalResponse{ err = p.sigConn.WriteResponse(&livekit.SignalResponse{
@@ -232,35 +206,34 @@ func (p *ParticipantImpl) Answer(sdp webrtc.SessionDescription) (answer webrtc.S
return return
} }
// HandleNegotiate when receiving session description from client // client intends to publish track, this function records track details and schedules negotiation
func (p *ParticipantImpl) HandleNegotiate(sd webrtc.SessionDescription) error { func (p *ParticipantImpl) AddTrack(clientId, name string, trackType livekit.TrackType) {
if err := p.peerConn.SetRemoteDescription(sd); err != nil { p.lock.Lock()
return errors.Wrap(err, "could not set remote description") defer p.lock.Unlock()
p.pendingTracks[clientId] = &livekit.TrackInfo{
Type: trackType,
Name: name,
} }
if sd.Type == webrtc.SDPTypeOffer { p.scheduleNegotiate()
answer, err := p.peerConn.CreateAnswer(nil) }
if err != nil {
return errors.Wrap(err, "could not create answer")
}
if err = p.peerConn.SetLocalDescription(answer); err != nil { func (p *ParticipantImpl) RemoveTrack(sid string) error {
return errors.Wrap(err, "could not set local description") p.lock.Lock()
} defer p.lock.Unlock()
// send a negotiate response back //
return p.sigConn.WriteResponse(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Negotiate{
Negotiate: ToProtoSessionDescription(answer),
},
})
}
p.scheduleNegotiate()
return nil return nil
} }
func (p *ParticipantImpl) SetRemoteDescription(sdp webrtc.SessionDescription) error { func (p *ParticipantImpl) HandleAnswer(sdp webrtc.SessionDescription) error {
logger.GetLogger().Debugw("setting remote description", "type", sdp.Type) if sdp.Type != webrtc.SDPTypeAnswer {
return ErrUnexpectedOffer
}
logger.GetLogger().Debugw("setting remote answer")
if err := p.peerConn.SetRemoteDescription(sdp); err != nil { if err := p.peerConn.SetRemoteDescription(sdp); err != nil {
return errors.Wrap(err, "could not set remote description") return errors.Wrap(err, "could not set remote description")
} }
@@ -391,6 +364,41 @@ func (p *ParticipantImpl) RemoveDownTrack(streamId string, dt *sfu.DownTrack) {
p.subscribedTracks[streamId] = newTracks p.subscribedTracks[streamId] = newTracks
} }
func (p *ParticipantImpl) scheduleNegotiate() {
p.debouncedNegotiate(p.negotiate)
}
func (p *ParticipantImpl) negotiate() {
offer, err := p.peerConn.CreateOffer(nil)
if err != nil {
logger.GetLogger().Errorw("could not create offer", "err", err)
return
}
if p.peerConn.SignalingState() != webrtc.SignalingStateStable {
// try this again
p.scheduleNegotiate()
return
}
err = p.peerConn.SetLocalDescription(offer)
if err != nil {
logger.GetLogger().Errorw("could not set local description", "err", err)
return
}
logger.GetLogger().Debugw("sending available offer to participant")
err = p.sigConn.WriteResponse(&livekit.SignalResponse{
Message: &livekit.SignalResponse_Offer{
Offer: ToProtoSessionDescription(offer),
},
})
if err != nil {
logger.GetLogger().Errorw("could not send offer to peer",
"err", err)
}
}
func (p *ParticipantImpl) updateState(state livekit.ParticipantInfo_State) { func (p *ParticipantImpl) updateState(state livekit.ParticipantInfo_State) {
if state == p.state { if state == p.state {
return return
@@ -410,10 +418,10 @@ func (p *ParticipantImpl) onMediaTrack(track *webrtc.TrackRemote, rtpReceiver *w
logger.GetLogger().Debugw("remoteTrack added", "participantId", p.ID(), "remoteTrack", track.ID()) logger.GetLogger().Debugw("remoteTrack added", "participantId", p.ID(), "remoteTrack", track.ID())
// create ReceiverImpl // create ReceiverImpl
receiver := NewReceiver(p.id, rtpReceiver, p.bi) receiver := NewReceiver(p.rtcpCh, rtpReceiver, track)
mt := NewMediaTrack(p.id, p.rtcpCh, track, receiver) mt := NewMediaTrack(p.id, p.rtcpCh, track, receiver)
p.handleTrackPublished(mt) p.handleTrackPublished(track.ID(), mt)
} }
func (p *ParticipantImpl) onDataChannel(dc *webrtc.DataChannel) { func (p *ParticipantImpl) onDataChannel(dc *webrtc.DataChannel) {
@@ -429,13 +437,22 @@ func (p *ParticipantImpl) onDataChannel(dc *webrtc.DataChannel) {
dt.Start() dt.Start()
p.handleTrackPublished(dt) cid := fmt.Sprintf("%d", dc.ID())
p.handleTrackPublished(cid, dt)
} }
func (p *ParticipantImpl) handleTrackPublished(track types.PublishedTrack) { func (p *ParticipantImpl) handleTrackPublished(clientId string, track types.PublishedTrack) {
// fill in
p.lock.Lock() p.lock.Lock()
defer p.lock.Unlock()
ti := p.pendingTracks[clientId]
if ti == nil {
logger.GetLogger().Errorw("track info not published prior to track", "clientId", clientId)
} else {
track.SetName(ti.Name)
delete(p.pendingTracks, clientId)
}
p.publishedTracks[track.ID()] = track p.publishedTracks[track.ID()] = track
p.lock.Unlock()
track.Start() track.Start()
+54 -49
View File
@@ -1,9 +1,8 @@
package rtc package rtc
import ( import (
"sync"
"github.com/pion/ion-sfu/pkg/buffer" "github.com/pion/ion-sfu/pkg/buffer"
"github.com/pion/rtcp"
"github.com/pion/rtp" "github.com/pion/rtp"
"github.com/pion/webrtc/v3" "github.com/pion/webrtc/v3"
@@ -15,64 +14,70 @@ const (
maxChanSize = 1024 maxChanSize = 1024
) )
// A receiver is responsible for pulling from a remoteTrack // A receiver is responsible for pulling from a single logical track
type ReceiverImpl struct { type ReceiverImpl struct {
participantId string rtpReceiver *webrtc.RTPReceiver
rtpReceiver *webrtc.RTPReceiver track *webrtc.TrackRemote
track *webrtc.TrackRemote buffer *buffer.Buffer
bi *buffer.Interceptor rtcpReader *buffer.RTCPReader
once sync.Once rtcpChan chan []rtcp.Packet
bytesRead int64
} }
func NewReceiver(peerId string, rtpReceiver *webrtc.RTPReceiver, bi *buffer.Interceptor) *ReceiverImpl { func NewReceiver(rtcpCh chan []rtcp.Packet, rtpReceiver *webrtc.RTPReceiver, track *webrtc.TrackRemote) *ReceiverImpl {
return &ReceiverImpl{ r := &ReceiverImpl{
participantId: peerId, rtpReceiver: rtpReceiver,
rtpReceiver: rtpReceiver, rtcpChan: rtcpCh,
track: rtpReceiver.Track(), track: track,
bi: bi,
once: sync.Once{},
} }
}
func (r *ReceiverImpl) TrackId() string { r.buffer, r.rtcpReader = bufferFactory.GetBufferPair(uint32(track.SSRC()))
return r.track.ID()
}
// starts reading RTP and push to buffer // when we have feedback for the sender, send through the rtcp channel
func (r *ReceiverImpl) Start() { r.buffer.OnFeedback(func(fb []rtcp.Packet) {
r.once.Do(func() { if r.rtcpChan != nil {
go r.rtcpWorker() r.rtcpChan <- fb
}
}) })
}
// PacketBuffer interface, to provide forwarders packets from the buffer r.buffer.OnTransportWideCC(func(sn uint16, timeNS int64, marker bool) {
func (r *ReceiverImpl) GetBufferedPackets(mediaSSRC uint32, snOffset uint16, tsOffset uint32, sn []uint16) []rtp.Packet { // TODO: figure out how to handle this
if r.bi == nil { })
return nil
}
return r.bi.GetBufferedPackets(uint32(r.track.SSRC()), mediaSSRC, snOffset, tsOffset, sn)
}
func (r *ReceiverImpl) ReadRTP() (*rtp.Packet, error) { // received sender updates
return r.track.ReadRTP() r.rtcpReader.OnPacket(func(bytes []byte) {
} pkts, err := rtcp.Unmarshal(bytes)
if err != nil {
// rtcpWorker reads RTCP messages from receiver, notifies buffer logger.GetLogger().Warnw("could not unmarshal RTCP packet")
func (r *ReceiverImpl) rtcpWorker() {
// consume RTCP from the sender/source, but don't need to do anything with the packets
for {
_, err := r.rtpReceiver.ReadRTCP()
if IsEOF(err) {
return return
} }
if err != nil { for _, pkt := range pkts {
logger.GetLogger().Warnw("receiver error reading RTCP", switch p := pkt.(type) {
"participant", r.participantId, case *rtcp.SenderReport:
"remoteTrack", r.track.SSRC(), r.buffer.SetSenderReportData(p.RTPTime, p.NTPTime)
"err", err, case *rtcp.SourceDescription:
) // TODO: see what we'd want to do with this
continue }
} }
})
return r
}
// PacketBuffer interface, retrieves a packet from buffer and deserializes
// it's possible that the packet can't be found, or the connection has been closed (io.EOF)
func (r *ReceiverImpl) GetBufferedPacket(pktBuf []byte, sn uint16, snOffset uint16) (p rtp.Packet, err error) {
if pktBuf == nil {
pktBuf = make([]byte, rtpPacketMaxSize)
} }
size, err := r.buffer.GetPacket(pktBuf, sn+snOffset)
if err != nil {
return
}
err = p.Unmarshal(pktBuf[:size])
return
}
func (r *ReceiverImpl) RTPChan() <-chan rtp.Packet {
return r.buffer.PacketChan()
} }
+1 -1
View File
@@ -137,7 +137,7 @@ func (r *Room) onTrackAdded(participant types.Participant, track types.Published
// this is the default behavior. in the future this could be more selective // this is the default behavior. in the future this could be more selective
for _, existingParticipant := range r.participants { for _, existingParticipant := range r.participants {
if existingParticipant == participant { if existingParticipant == participant {
// skip publishing peer // skip publishing participant
continue continue
} }
if existingParticipant.State() != livekit.ParticipantInfo_JOINED { if existingParticipant.State() != livekit.ParticipantInfo_JOINED {
+1 -1
View File
@@ -112,7 +112,7 @@ func TestNewTrack(t *testing.T) {
p3 := participants[3].(*typesfakes.FakeParticipant) p3 := participants[3].(*typesfakes.FakeParticipant)
// p3 adds track // p3 adds track
track := newMockTrack(livekit.TrackInfo_VIDEO, "webcam") track := newMockTrack(livekit.TrackType_VIDEO, "webcam")
trackCB := p3.OnTrackPublishedArgsForCall(0) trackCB := p3.OnTrackPublishedArgsForCall(0)
assert.NotNil(t, trackCB) assert.NotNil(t, trackCB)
trackCB(p3, track) trackCB(p3, track)
+29 -24
View File
@@ -45,6 +45,7 @@ type PeerConnection interface {
// used by mediatrack // used by mediatrack
AddTransceiverFromTrack(track webrtc.TrackLocal, init ...webrtc.RtpTransceiverInit) (*webrtc.RTPTransceiver, error) AddTransceiverFromTrack(track webrtc.TrackLocal, init ...webrtc.RtpTransceiverInit) (*webrtc.RTPTransceiver, error)
ConnectionState() webrtc.PeerConnectionState ConnectionState() webrtc.PeerConnectionState
SignalingState() webrtc.SignalingState
RemoveTrack(sender *webrtc.RTPSender) error RemoveTrack(sender *webrtc.RTPSender) error
} }
@@ -54,9 +55,10 @@ type Participant interface {
Name() string Name() string
State() livekit.ParticipantInfo_State State() livekit.ParticipantInfo_State
ToProto() *livekit.ParticipantInfo ToProto() *livekit.ParticipantInfo
AddTrack(clientId, name string, trackType livekit.TrackType)
RemoveTrack(sid string) error
Answer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error) Answer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error)
HandleNegotiate(sd webrtc.SessionDescription) error HandleAnswer(sdp webrtc.SessionDescription) error
SetRemoteDescription(sdp webrtc.SessionDescription) error
AddICECandidate(candidate webrtc.ICECandidateInit) error AddICECandidate(candidate webrtc.ICECandidateInit) error
AddSubscriber(op Participant) error AddSubscriber(op Participant) error
RemoveSubscriber(peerId string) RemoveSubscriber(peerId string)
@@ -68,8 +70,6 @@ type Participant interface {
Close() error Close() error
// callbacks // callbacks
// OnOffer - offer is ready for remote peer
OnOffer(func(webrtc.SessionDescription))
// OnICECandidate - ice candidate discovered for local peer // OnICECandidate - ice candidate discovered for local peer
OnICECandidate(func(c *webrtc.ICECandidateInit)) OnICECandidate(func(c *webrtc.ICECandidateInit))
OnStateChange(func(p Participant, oldState livekit.ParticipantInfo_State)) OnStateChange(func(p Participant, oldState livekit.ParticipantInfo_State))
@@ -91,8 +91,9 @@ type Participant interface {
type PublishedTrack interface { type PublishedTrack interface {
Start() Start()
ID() string ID() string
Kind() livekit.TrackInfo_Type Kind() livekit.TrackType
StreamID() string Name() string
SetName(name string)
IsMuted() bool IsMuted() bool
AddSubscriber(participant Participant) error AddSubscriber(participant Participant) error
RemoveSubscriber(participantId string) RemoveSubscriber(participantId string)
@@ -101,26 +102,30 @@ type PublishedTrack interface {
//counterfeiter:generate . Receiver //counterfeiter:generate . Receiver
type Receiver interface { type Receiver interface {
TrackId() string RTPChan() <-chan rtp.Packet
Start() GetBufferedPacket(pktBuf []byte, sn uint16, snOffset uint16) (rtp.Packet, error)
GetBufferedPackets(mediaSSRC uint32, snOffset uint16, tsOffset uint32, sn []uint16) []rtp.Packet
ReadRTP() (*rtp.Packet, error)
} }
//counterfeiter:generate . PacketBuffer // DownTrack publishes data to a target participant
type PacketBuffer interface { // using this interface to make testing more practical
GetBufferedPackets(mediaSSRC uint32, snOffset uint16, tsOffset uint32, sn []uint16) []rtp.Packet //counterfeiter:generate . DownTrack
} type DownTrack interface {
WriteRTP(p rtp.Packet) error
// a Forwarder publishes data to a target remoteTrack or datachannel
// manages the RTCP loop with the target participant
//counterfeiter:generate . Forwarder
type Forwarder interface {
WriteRTP(*rtp.Packet) error
Start()
Close() Close()
CreatedAt() time.Time OnCloseHandler(fn func())
Track() *sfu.DownTrack OnBind(fn func())
SSRC() uint32
LastSSRC() uint32
SnOffset() uint16
TsOffset() uint32
GetNACKSeqNo(seqNo []uint16) []uint16
}
OnClose(func(Forwarder)) // interface for properties of webrtc.TrackRemote
//counterfeiter:generate . TrackRemote
type TrackRemote interface {
SSRC() webrtc.SSRC
StreamID() string
Kind() webrtc.RTPCodecType
Codec() webrtc.RTPCodecParameters
} }
+559
View File
@@ -0,0 +1,559 @@
// Code generated by counterfeiter. DO NOT EDIT.
package typesfakes
import (
"sync"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/pion/rtp"
)
type FakeDownTrack struct {
CloseStub func()
closeMutex sync.RWMutex
closeArgsForCall []struct {
}
GetNACKSeqNoStub func([]uint16) []uint16
getNACKSeqNoMutex sync.RWMutex
getNACKSeqNoArgsForCall []struct {
arg1 []uint16
}
getNACKSeqNoReturns struct {
result1 []uint16
}
getNACKSeqNoReturnsOnCall map[int]struct {
result1 []uint16
}
LastSSRCStub func() uint32
lastSSRCMutex sync.RWMutex
lastSSRCArgsForCall []struct {
}
lastSSRCReturns struct {
result1 uint32
}
lastSSRCReturnsOnCall map[int]struct {
result1 uint32
}
OnBindStub func(func())
onBindMutex sync.RWMutex
onBindArgsForCall []struct {
arg1 func()
}
OnCloseHandlerStub func(func())
onCloseHandlerMutex sync.RWMutex
onCloseHandlerArgsForCall []struct {
arg1 func()
}
SSRCStub func() uint32
sSRCMutex sync.RWMutex
sSRCArgsForCall []struct {
}
sSRCReturns struct {
result1 uint32
}
sSRCReturnsOnCall map[int]struct {
result1 uint32
}
SnOffsetStub func() uint16
snOffsetMutex sync.RWMutex
snOffsetArgsForCall []struct {
}
snOffsetReturns struct {
result1 uint16
}
snOffsetReturnsOnCall map[int]struct {
result1 uint16
}
TsOffsetStub func() uint32
tsOffsetMutex sync.RWMutex
tsOffsetArgsForCall []struct {
}
tsOffsetReturns struct {
result1 uint32
}
tsOffsetReturnsOnCall map[int]struct {
result1 uint32
}
WriteRTPStub func(rtp.Packet) error
writeRTPMutex sync.RWMutex
writeRTPArgsForCall []struct {
arg1 rtp.Packet
}
writeRTPReturns struct {
result1 error
}
writeRTPReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeDownTrack) Close() {
fake.closeMutex.Lock()
fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
}{})
stub := fake.CloseStub
fake.recordInvocation("Close", []interface{}{})
fake.closeMutex.Unlock()
if stub != nil {
fake.CloseStub()
}
}
func (fake *FakeDownTrack) CloseCallCount() int {
fake.closeMutex.RLock()
defer fake.closeMutex.RUnlock()
return len(fake.closeArgsForCall)
}
func (fake *FakeDownTrack) CloseCalls(stub func()) {
fake.closeMutex.Lock()
defer fake.closeMutex.Unlock()
fake.CloseStub = stub
}
func (fake *FakeDownTrack) GetNACKSeqNo(arg1 []uint16) []uint16 {
var arg1Copy []uint16
if arg1 != nil {
arg1Copy = make([]uint16, len(arg1))
copy(arg1Copy, arg1)
}
fake.getNACKSeqNoMutex.Lock()
ret, specificReturn := fake.getNACKSeqNoReturnsOnCall[len(fake.getNACKSeqNoArgsForCall)]
fake.getNACKSeqNoArgsForCall = append(fake.getNACKSeqNoArgsForCall, struct {
arg1 []uint16
}{arg1Copy})
stub := fake.GetNACKSeqNoStub
fakeReturns := fake.getNACKSeqNoReturns
fake.recordInvocation("GetNACKSeqNo", []interface{}{arg1Copy})
fake.getNACKSeqNoMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeDownTrack) GetNACKSeqNoCallCount() int {
fake.getNACKSeqNoMutex.RLock()
defer fake.getNACKSeqNoMutex.RUnlock()
return len(fake.getNACKSeqNoArgsForCall)
}
func (fake *FakeDownTrack) GetNACKSeqNoCalls(stub func([]uint16) []uint16) {
fake.getNACKSeqNoMutex.Lock()
defer fake.getNACKSeqNoMutex.Unlock()
fake.GetNACKSeqNoStub = stub
}
func (fake *FakeDownTrack) GetNACKSeqNoArgsForCall(i int) []uint16 {
fake.getNACKSeqNoMutex.RLock()
defer fake.getNACKSeqNoMutex.RUnlock()
argsForCall := fake.getNACKSeqNoArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeDownTrack) GetNACKSeqNoReturns(result1 []uint16) {
fake.getNACKSeqNoMutex.Lock()
defer fake.getNACKSeqNoMutex.Unlock()
fake.GetNACKSeqNoStub = nil
fake.getNACKSeqNoReturns = struct {
result1 []uint16
}{result1}
}
func (fake *FakeDownTrack) GetNACKSeqNoReturnsOnCall(i int, result1 []uint16) {
fake.getNACKSeqNoMutex.Lock()
defer fake.getNACKSeqNoMutex.Unlock()
fake.GetNACKSeqNoStub = nil
if fake.getNACKSeqNoReturnsOnCall == nil {
fake.getNACKSeqNoReturnsOnCall = make(map[int]struct {
result1 []uint16
})
}
fake.getNACKSeqNoReturnsOnCall[i] = struct {
result1 []uint16
}{result1}
}
func (fake *FakeDownTrack) LastSSRC() uint32 {
fake.lastSSRCMutex.Lock()
ret, specificReturn := fake.lastSSRCReturnsOnCall[len(fake.lastSSRCArgsForCall)]
fake.lastSSRCArgsForCall = append(fake.lastSSRCArgsForCall, struct {
}{})
stub := fake.LastSSRCStub
fakeReturns := fake.lastSSRCReturns
fake.recordInvocation("LastSSRC", []interface{}{})
fake.lastSSRCMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeDownTrack) LastSSRCCallCount() int {
fake.lastSSRCMutex.RLock()
defer fake.lastSSRCMutex.RUnlock()
return len(fake.lastSSRCArgsForCall)
}
func (fake *FakeDownTrack) LastSSRCCalls(stub func() uint32) {
fake.lastSSRCMutex.Lock()
defer fake.lastSSRCMutex.Unlock()
fake.LastSSRCStub = stub
}
func (fake *FakeDownTrack) LastSSRCReturns(result1 uint32) {
fake.lastSSRCMutex.Lock()
defer fake.lastSSRCMutex.Unlock()
fake.LastSSRCStub = nil
fake.lastSSRCReturns = struct {
result1 uint32
}{result1}
}
func (fake *FakeDownTrack) LastSSRCReturnsOnCall(i int, result1 uint32) {
fake.lastSSRCMutex.Lock()
defer fake.lastSSRCMutex.Unlock()
fake.LastSSRCStub = nil
if fake.lastSSRCReturnsOnCall == nil {
fake.lastSSRCReturnsOnCall = make(map[int]struct {
result1 uint32
})
}
fake.lastSSRCReturnsOnCall[i] = struct {
result1 uint32
}{result1}
}
func (fake *FakeDownTrack) OnBind(arg1 func()) {
fake.onBindMutex.Lock()
fake.onBindArgsForCall = append(fake.onBindArgsForCall, struct {
arg1 func()
}{arg1})
stub := fake.OnBindStub
fake.recordInvocation("OnBind", []interface{}{arg1})
fake.onBindMutex.Unlock()
if stub != nil {
fake.OnBindStub(arg1)
}
}
func (fake *FakeDownTrack) OnBindCallCount() int {
fake.onBindMutex.RLock()
defer fake.onBindMutex.RUnlock()
return len(fake.onBindArgsForCall)
}
func (fake *FakeDownTrack) OnBindCalls(stub func(func())) {
fake.onBindMutex.Lock()
defer fake.onBindMutex.Unlock()
fake.OnBindStub = stub
}
func (fake *FakeDownTrack) OnBindArgsForCall(i int) func() {
fake.onBindMutex.RLock()
defer fake.onBindMutex.RUnlock()
argsForCall := fake.onBindArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeDownTrack) OnCloseHandler(arg1 func()) {
fake.onCloseHandlerMutex.Lock()
fake.onCloseHandlerArgsForCall = append(fake.onCloseHandlerArgsForCall, struct {
arg1 func()
}{arg1})
stub := fake.OnCloseHandlerStub
fake.recordInvocation("OnCloseHandler", []interface{}{arg1})
fake.onCloseHandlerMutex.Unlock()
if stub != nil {
fake.OnCloseHandlerStub(arg1)
}
}
func (fake *FakeDownTrack) OnCloseHandlerCallCount() int {
fake.onCloseHandlerMutex.RLock()
defer fake.onCloseHandlerMutex.RUnlock()
return len(fake.onCloseHandlerArgsForCall)
}
func (fake *FakeDownTrack) OnCloseHandlerCalls(stub func(func())) {
fake.onCloseHandlerMutex.Lock()
defer fake.onCloseHandlerMutex.Unlock()
fake.OnCloseHandlerStub = stub
}
func (fake *FakeDownTrack) OnCloseHandlerArgsForCall(i int) func() {
fake.onCloseHandlerMutex.RLock()
defer fake.onCloseHandlerMutex.RUnlock()
argsForCall := fake.onCloseHandlerArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeDownTrack) SSRC() uint32 {
fake.sSRCMutex.Lock()
ret, specificReturn := fake.sSRCReturnsOnCall[len(fake.sSRCArgsForCall)]
fake.sSRCArgsForCall = append(fake.sSRCArgsForCall, struct {
}{})
stub := fake.SSRCStub
fakeReturns := fake.sSRCReturns
fake.recordInvocation("SSRC", []interface{}{})
fake.sSRCMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeDownTrack) SSRCCallCount() int {
fake.sSRCMutex.RLock()
defer fake.sSRCMutex.RUnlock()
return len(fake.sSRCArgsForCall)
}
func (fake *FakeDownTrack) SSRCCalls(stub func() uint32) {
fake.sSRCMutex.Lock()
defer fake.sSRCMutex.Unlock()
fake.SSRCStub = stub
}
func (fake *FakeDownTrack) SSRCReturns(result1 uint32) {
fake.sSRCMutex.Lock()
defer fake.sSRCMutex.Unlock()
fake.SSRCStub = nil
fake.sSRCReturns = struct {
result1 uint32
}{result1}
}
func (fake *FakeDownTrack) SSRCReturnsOnCall(i int, result1 uint32) {
fake.sSRCMutex.Lock()
defer fake.sSRCMutex.Unlock()
fake.SSRCStub = nil
if fake.sSRCReturnsOnCall == nil {
fake.sSRCReturnsOnCall = make(map[int]struct {
result1 uint32
})
}
fake.sSRCReturnsOnCall[i] = struct {
result1 uint32
}{result1}
}
func (fake *FakeDownTrack) SnOffset() uint16 {
fake.snOffsetMutex.Lock()
ret, specificReturn := fake.snOffsetReturnsOnCall[len(fake.snOffsetArgsForCall)]
fake.snOffsetArgsForCall = append(fake.snOffsetArgsForCall, struct {
}{})
stub := fake.SnOffsetStub
fakeReturns := fake.snOffsetReturns
fake.recordInvocation("SnOffset", []interface{}{})
fake.snOffsetMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeDownTrack) SnOffsetCallCount() int {
fake.snOffsetMutex.RLock()
defer fake.snOffsetMutex.RUnlock()
return len(fake.snOffsetArgsForCall)
}
func (fake *FakeDownTrack) SnOffsetCalls(stub func() uint16) {
fake.snOffsetMutex.Lock()
defer fake.snOffsetMutex.Unlock()
fake.SnOffsetStub = stub
}
func (fake *FakeDownTrack) SnOffsetReturns(result1 uint16) {
fake.snOffsetMutex.Lock()
defer fake.snOffsetMutex.Unlock()
fake.SnOffsetStub = nil
fake.snOffsetReturns = struct {
result1 uint16
}{result1}
}
func (fake *FakeDownTrack) SnOffsetReturnsOnCall(i int, result1 uint16) {
fake.snOffsetMutex.Lock()
defer fake.snOffsetMutex.Unlock()
fake.SnOffsetStub = nil
if fake.snOffsetReturnsOnCall == nil {
fake.snOffsetReturnsOnCall = make(map[int]struct {
result1 uint16
})
}
fake.snOffsetReturnsOnCall[i] = struct {
result1 uint16
}{result1}
}
func (fake *FakeDownTrack) TsOffset() uint32 {
fake.tsOffsetMutex.Lock()
ret, specificReturn := fake.tsOffsetReturnsOnCall[len(fake.tsOffsetArgsForCall)]
fake.tsOffsetArgsForCall = append(fake.tsOffsetArgsForCall, struct {
}{})
stub := fake.TsOffsetStub
fakeReturns := fake.tsOffsetReturns
fake.recordInvocation("TsOffset", []interface{}{})
fake.tsOffsetMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeDownTrack) TsOffsetCallCount() int {
fake.tsOffsetMutex.RLock()
defer fake.tsOffsetMutex.RUnlock()
return len(fake.tsOffsetArgsForCall)
}
func (fake *FakeDownTrack) TsOffsetCalls(stub func() uint32) {
fake.tsOffsetMutex.Lock()
defer fake.tsOffsetMutex.Unlock()
fake.TsOffsetStub = stub
}
func (fake *FakeDownTrack) TsOffsetReturns(result1 uint32) {
fake.tsOffsetMutex.Lock()
defer fake.tsOffsetMutex.Unlock()
fake.TsOffsetStub = nil
fake.tsOffsetReturns = struct {
result1 uint32
}{result1}
}
func (fake *FakeDownTrack) TsOffsetReturnsOnCall(i int, result1 uint32) {
fake.tsOffsetMutex.Lock()
defer fake.tsOffsetMutex.Unlock()
fake.TsOffsetStub = nil
if fake.tsOffsetReturnsOnCall == nil {
fake.tsOffsetReturnsOnCall = make(map[int]struct {
result1 uint32
})
}
fake.tsOffsetReturnsOnCall[i] = struct {
result1 uint32
}{result1}
}
func (fake *FakeDownTrack) WriteRTP(arg1 rtp.Packet) error {
fake.writeRTPMutex.Lock()
ret, specificReturn := fake.writeRTPReturnsOnCall[len(fake.writeRTPArgsForCall)]
fake.writeRTPArgsForCall = append(fake.writeRTPArgsForCall, struct {
arg1 rtp.Packet
}{arg1})
stub := fake.WriteRTPStub
fakeReturns := fake.writeRTPReturns
fake.recordInvocation("WriteRTP", []interface{}{arg1})
fake.writeRTPMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeDownTrack) WriteRTPCallCount() int {
fake.writeRTPMutex.RLock()
defer fake.writeRTPMutex.RUnlock()
return len(fake.writeRTPArgsForCall)
}
func (fake *FakeDownTrack) WriteRTPCalls(stub func(rtp.Packet) error) {
fake.writeRTPMutex.Lock()
defer fake.writeRTPMutex.Unlock()
fake.WriteRTPStub = stub
}
func (fake *FakeDownTrack) WriteRTPArgsForCall(i int) rtp.Packet {
fake.writeRTPMutex.RLock()
defer fake.writeRTPMutex.RUnlock()
argsForCall := fake.writeRTPArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeDownTrack) WriteRTPReturns(result1 error) {
fake.writeRTPMutex.Lock()
defer fake.writeRTPMutex.Unlock()
fake.WriteRTPStub = nil
fake.writeRTPReturns = struct {
result1 error
}{result1}
}
func (fake *FakeDownTrack) WriteRTPReturnsOnCall(i int, result1 error) {
fake.writeRTPMutex.Lock()
defer fake.writeRTPMutex.Unlock()
fake.WriteRTPStub = nil
if fake.writeRTPReturnsOnCall == nil {
fake.writeRTPReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.writeRTPReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeDownTrack) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.closeMutex.RLock()
defer fake.closeMutex.RUnlock()
fake.getNACKSeqNoMutex.RLock()
defer fake.getNACKSeqNoMutex.RUnlock()
fake.lastSSRCMutex.RLock()
defer fake.lastSSRCMutex.RUnlock()
fake.onBindMutex.RLock()
defer fake.onBindMutex.RUnlock()
fake.onCloseHandlerMutex.RLock()
defer fake.onCloseHandlerMutex.RUnlock()
fake.sSRCMutex.RLock()
defer fake.sSRCMutex.RUnlock()
fake.snOffsetMutex.RLock()
defer fake.snOffsetMutex.RUnlock()
fake.tsOffsetMutex.RLock()
defer fake.tsOffsetMutex.RUnlock()
fake.writeRTPMutex.RLock()
defer fake.writeRTPMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeDownTrack) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ types.DownTrack = new(FakeDownTrack)
-343
View File
@@ -1,343 +0,0 @@
// Code generated by counterfeiter. DO NOT EDIT.
package typesfakes
import (
"sync"
"time"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu"
"github.com/pion/rtp"
)
type FakeForwarder struct {
CloseStub func()
closeMutex sync.RWMutex
closeArgsForCall []struct {
}
CreatedAtStub func() time.Time
createdAtMutex sync.RWMutex
createdAtArgsForCall []struct {
}
createdAtReturns struct {
result1 time.Time
}
createdAtReturnsOnCall map[int]struct {
result1 time.Time
}
OnCloseStub func(func(types.Forwarder))
onCloseMutex sync.RWMutex
onCloseArgsForCall []struct {
arg1 func(types.Forwarder)
}
StartStub func()
startMutex sync.RWMutex
startArgsForCall []struct {
}
TrackStub func() *sfu.DownTrack
trackMutex sync.RWMutex
trackArgsForCall []struct {
}
trackReturns struct {
result1 *sfu.DownTrack
}
trackReturnsOnCall map[int]struct {
result1 *sfu.DownTrack
}
WriteRTPStub func(*rtp.Packet) error
writeRTPMutex sync.RWMutex
writeRTPArgsForCall []struct {
arg1 *rtp.Packet
}
writeRTPReturns struct {
result1 error
}
writeRTPReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeForwarder) Close() {
fake.closeMutex.Lock()
fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
}{})
stub := fake.CloseStub
fake.recordInvocation("Close", []interface{}{})
fake.closeMutex.Unlock()
if stub != nil {
fake.CloseStub()
}
}
func (fake *FakeForwarder) CloseCallCount() int {
fake.closeMutex.RLock()
defer fake.closeMutex.RUnlock()
return len(fake.closeArgsForCall)
}
func (fake *FakeForwarder) CloseCalls(stub func()) {
fake.closeMutex.Lock()
defer fake.closeMutex.Unlock()
fake.CloseStub = stub
}
func (fake *FakeForwarder) CreatedAt() time.Time {
fake.createdAtMutex.Lock()
ret, specificReturn := fake.createdAtReturnsOnCall[len(fake.createdAtArgsForCall)]
fake.createdAtArgsForCall = append(fake.createdAtArgsForCall, struct {
}{})
stub := fake.CreatedAtStub
fakeReturns := fake.createdAtReturns
fake.recordInvocation("CreatedAt", []interface{}{})
fake.createdAtMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeForwarder) CreatedAtCallCount() int {
fake.createdAtMutex.RLock()
defer fake.createdAtMutex.RUnlock()
return len(fake.createdAtArgsForCall)
}
func (fake *FakeForwarder) CreatedAtCalls(stub func() time.Time) {
fake.createdAtMutex.Lock()
defer fake.createdAtMutex.Unlock()
fake.CreatedAtStub = stub
}
func (fake *FakeForwarder) CreatedAtReturns(result1 time.Time) {
fake.createdAtMutex.Lock()
defer fake.createdAtMutex.Unlock()
fake.CreatedAtStub = nil
fake.createdAtReturns = struct {
result1 time.Time
}{result1}
}
func (fake *FakeForwarder) CreatedAtReturnsOnCall(i int, result1 time.Time) {
fake.createdAtMutex.Lock()
defer fake.createdAtMutex.Unlock()
fake.CreatedAtStub = nil
if fake.createdAtReturnsOnCall == nil {
fake.createdAtReturnsOnCall = make(map[int]struct {
result1 time.Time
})
}
fake.createdAtReturnsOnCall[i] = struct {
result1 time.Time
}{result1}
}
func (fake *FakeForwarder) OnClose(arg1 func(types.Forwarder)) {
fake.onCloseMutex.Lock()
fake.onCloseArgsForCall = append(fake.onCloseArgsForCall, struct {
arg1 func(types.Forwarder)
}{arg1})
stub := fake.OnCloseStub
fake.recordInvocation("OnClose", []interface{}{arg1})
fake.onCloseMutex.Unlock()
if stub != nil {
fake.OnCloseStub(arg1)
}
}
func (fake *FakeForwarder) OnCloseCallCount() int {
fake.onCloseMutex.RLock()
defer fake.onCloseMutex.RUnlock()
return len(fake.onCloseArgsForCall)
}
func (fake *FakeForwarder) OnCloseCalls(stub func(func(types.Forwarder))) {
fake.onCloseMutex.Lock()
defer fake.onCloseMutex.Unlock()
fake.OnCloseStub = stub
}
func (fake *FakeForwarder) OnCloseArgsForCall(i int) func(types.Forwarder) {
fake.onCloseMutex.RLock()
defer fake.onCloseMutex.RUnlock()
argsForCall := fake.onCloseArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeForwarder) Start() {
fake.startMutex.Lock()
fake.startArgsForCall = append(fake.startArgsForCall, struct {
}{})
stub := fake.StartStub
fake.recordInvocation("Start", []interface{}{})
fake.startMutex.Unlock()
if stub != nil {
fake.StartStub()
}
}
func (fake *FakeForwarder) StartCallCount() int {
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
return len(fake.startArgsForCall)
}
func (fake *FakeForwarder) StartCalls(stub func()) {
fake.startMutex.Lock()
defer fake.startMutex.Unlock()
fake.StartStub = stub
}
func (fake *FakeForwarder) Track() *sfu.DownTrack {
fake.trackMutex.Lock()
ret, specificReturn := fake.trackReturnsOnCall[len(fake.trackArgsForCall)]
fake.trackArgsForCall = append(fake.trackArgsForCall, struct {
}{})
stub := fake.TrackStub
fakeReturns := fake.trackReturns
fake.recordInvocation("Track", []interface{}{})
fake.trackMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeForwarder) TrackCallCount() int {
fake.trackMutex.RLock()
defer fake.trackMutex.RUnlock()
return len(fake.trackArgsForCall)
}
func (fake *FakeForwarder) TrackCalls(stub func() *sfu.DownTrack) {
fake.trackMutex.Lock()
defer fake.trackMutex.Unlock()
fake.TrackStub = stub
}
func (fake *FakeForwarder) TrackReturns(result1 *sfu.DownTrack) {
fake.trackMutex.Lock()
defer fake.trackMutex.Unlock()
fake.TrackStub = nil
fake.trackReturns = struct {
result1 *sfu.DownTrack
}{result1}
}
func (fake *FakeForwarder) TrackReturnsOnCall(i int, result1 *sfu.DownTrack) {
fake.trackMutex.Lock()
defer fake.trackMutex.Unlock()
fake.TrackStub = nil
if fake.trackReturnsOnCall == nil {
fake.trackReturnsOnCall = make(map[int]struct {
result1 *sfu.DownTrack
})
}
fake.trackReturnsOnCall[i] = struct {
result1 *sfu.DownTrack
}{result1}
}
func (fake *FakeForwarder) WriteRTP(arg1 *rtp.Packet) error {
fake.writeRTPMutex.Lock()
ret, specificReturn := fake.writeRTPReturnsOnCall[len(fake.writeRTPArgsForCall)]
fake.writeRTPArgsForCall = append(fake.writeRTPArgsForCall, struct {
arg1 *rtp.Packet
}{arg1})
stub := fake.WriteRTPStub
fakeReturns := fake.writeRTPReturns
fake.recordInvocation("WriteRTP", []interface{}{arg1})
fake.writeRTPMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeForwarder) WriteRTPCallCount() int {
fake.writeRTPMutex.RLock()
defer fake.writeRTPMutex.RUnlock()
return len(fake.writeRTPArgsForCall)
}
func (fake *FakeForwarder) WriteRTPCalls(stub func(*rtp.Packet) error) {
fake.writeRTPMutex.Lock()
defer fake.writeRTPMutex.Unlock()
fake.WriteRTPStub = stub
}
func (fake *FakeForwarder) WriteRTPArgsForCall(i int) *rtp.Packet {
fake.writeRTPMutex.RLock()
defer fake.writeRTPMutex.RUnlock()
argsForCall := fake.writeRTPArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeForwarder) WriteRTPReturns(result1 error) {
fake.writeRTPMutex.Lock()
defer fake.writeRTPMutex.Unlock()
fake.WriteRTPStub = nil
fake.writeRTPReturns = struct {
result1 error
}{result1}
}
func (fake *FakeForwarder) WriteRTPReturnsOnCall(i int, result1 error) {
fake.writeRTPMutex.Lock()
defer fake.writeRTPMutex.Unlock()
fake.WriteRTPStub = nil
if fake.writeRTPReturnsOnCall == nil {
fake.writeRTPReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.writeRTPReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeForwarder) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.closeMutex.RLock()
defer fake.closeMutex.RUnlock()
fake.createdAtMutex.RLock()
defer fake.createdAtMutex.RUnlock()
fake.onCloseMutex.RLock()
defer fake.onCloseMutex.RUnlock()
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
fake.trackMutex.RLock()
defer fake.trackMutex.RUnlock()
fake.writeRTPMutex.RLock()
defer fake.writeRTPMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeForwarder) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ types.Forwarder = new(FakeForwarder)
@@ -1,123 +0,0 @@
// Code generated by counterfeiter. DO NOT EDIT.
package typesfakes
import (
"sync"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/pion/rtp"
)
type FakePacketBuffer struct {
GetBufferedPacketsStub func(uint32, uint16, uint32, []uint16) []rtp.Packet
getBufferedPacketsMutex sync.RWMutex
getBufferedPacketsArgsForCall []struct {
arg1 uint32
arg2 uint16
arg3 uint32
arg4 []uint16
}
getBufferedPacketsReturns struct {
result1 []rtp.Packet
}
getBufferedPacketsReturnsOnCall map[int]struct {
result1 []rtp.Packet
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakePacketBuffer) GetBufferedPackets(arg1 uint32, arg2 uint16, arg3 uint32, arg4 []uint16) []rtp.Packet {
var arg4Copy []uint16
if arg4 != nil {
arg4Copy = make([]uint16, len(arg4))
copy(arg4Copy, arg4)
}
fake.getBufferedPacketsMutex.Lock()
ret, specificReturn := fake.getBufferedPacketsReturnsOnCall[len(fake.getBufferedPacketsArgsForCall)]
fake.getBufferedPacketsArgsForCall = append(fake.getBufferedPacketsArgsForCall, struct {
arg1 uint32
arg2 uint16
arg3 uint32
arg4 []uint16
}{arg1, arg2, arg3, arg4Copy})
stub := fake.GetBufferedPacketsStub
fakeReturns := fake.getBufferedPacketsReturns
fake.recordInvocation("GetBufferedPackets", []interface{}{arg1, arg2, arg3, arg4Copy})
fake.getBufferedPacketsMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakePacketBuffer) GetBufferedPacketsCallCount() int {
fake.getBufferedPacketsMutex.RLock()
defer fake.getBufferedPacketsMutex.RUnlock()
return len(fake.getBufferedPacketsArgsForCall)
}
func (fake *FakePacketBuffer) GetBufferedPacketsCalls(stub func(uint32, uint16, uint32, []uint16) []rtp.Packet) {
fake.getBufferedPacketsMutex.Lock()
defer fake.getBufferedPacketsMutex.Unlock()
fake.GetBufferedPacketsStub = stub
}
func (fake *FakePacketBuffer) GetBufferedPacketsArgsForCall(i int) (uint32, uint16, uint32, []uint16) {
fake.getBufferedPacketsMutex.RLock()
defer fake.getBufferedPacketsMutex.RUnlock()
argsForCall := fake.getBufferedPacketsArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakePacketBuffer) GetBufferedPacketsReturns(result1 []rtp.Packet) {
fake.getBufferedPacketsMutex.Lock()
defer fake.getBufferedPacketsMutex.Unlock()
fake.GetBufferedPacketsStub = nil
fake.getBufferedPacketsReturns = struct {
result1 []rtp.Packet
}{result1}
}
func (fake *FakePacketBuffer) GetBufferedPacketsReturnsOnCall(i int, result1 []rtp.Packet) {
fake.getBufferedPacketsMutex.Lock()
defer fake.getBufferedPacketsMutex.Unlock()
fake.GetBufferedPacketsStub = nil
if fake.getBufferedPacketsReturnsOnCall == nil {
fake.getBufferedPacketsReturnsOnCall = make(map[int]struct {
result1 []rtp.Packet
})
}
fake.getBufferedPacketsReturnsOnCall[i] = struct {
result1 []rtp.Packet
}{result1}
}
func (fake *FakePacketBuffer) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.getBufferedPacketsMutex.RLock()
defer fake.getBufferedPacketsMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakePacketBuffer) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ types.PacketBuffer = new(FakePacketBuffer)
+156 -152
View File
@@ -39,6 +39,13 @@ type FakeParticipant struct {
addSubscriberReturnsOnCall map[int]struct { addSubscriberReturnsOnCall map[int]struct {
result1 error result1 error
} }
AddTrackStub func(string, string, livekit.TrackType)
addTrackMutex sync.RWMutex
addTrackArgsForCall []struct {
arg1 string
arg2 string
arg3 livekit.TrackType
}
AnswerStub func(webrtc.SessionDescription) (webrtc.SessionDescription, error) AnswerStub func(webrtc.SessionDescription) (webrtc.SessionDescription, error)
answerMutex sync.RWMutex answerMutex sync.RWMutex
answerArgsForCall []struct { answerArgsForCall []struct {
@@ -62,15 +69,15 @@ type FakeParticipant struct {
closeReturnsOnCall map[int]struct { closeReturnsOnCall map[int]struct {
result1 error result1 error
} }
HandleNegotiateStub func(webrtc.SessionDescription) error HandleAnswerStub func(webrtc.SessionDescription) error
handleNegotiateMutex sync.RWMutex handleAnswerMutex sync.RWMutex
handleNegotiateArgsForCall []struct { handleAnswerArgsForCall []struct {
arg1 webrtc.SessionDescription arg1 webrtc.SessionDescription
} }
handleNegotiateReturns struct { handleAnswerReturns struct {
result1 error result1 error
} }
handleNegotiateReturnsOnCall map[int]struct { handleAnswerReturnsOnCall map[int]struct {
result1 error result1 error
} }
IDStub func() string IDStub func() string
@@ -103,11 +110,6 @@ type FakeParticipant struct {
onICECandidateArgsForCall []struct { onICECandidateArgsForCall []struct {
arg1 func(c *webrtc.ICECandidateInit) arg1 func(c *webrtc.ICECandidateInit)
} }
OnOfferStub func(func(webrtc.SessionDescription))
onOfferMutex sync.RWMutex
onOfferArgsForCall []struct {
arg1 func(webrtc.SessionDescription)
}
OnStateChangeStub func(func(p types.Participant, oldState livekit.ParticipantInfo_State)) OnStateChangeStub func(func(p types.Participant, oldState livekit.ParticipantInfo_State))
onStateChangeMutex sync.RWMutex onStateChangeMutex sync.RWMutex
onStateChangeArgsForCall []struct { onStateChangeArgsForCall []struct {
@@ -144,6 +146,17 @@ type FakeParticipant struct {
removeSubscriberArgsForCall []struct { removeSubscriberArgsForCall []struct {
arg1 string arg1 string
} }
RemoveTrackStub func(string) error
removeTrackMutex sync.RWMutex
removeTrackArgsForCall []struct {
arg1 string
}
removeTrackReturns struct {
result1 error
}
removeTrackReturnsOnCall map[int]struct {
result1 error
}
SendJoinResponseStub func(*livekit.RoomInfo, []types.Participant) error SendJoinResponseStub func(*livekit.RoomInfo, []types.Participant) error
sendJoinResponseMutex sync.RWMutex sendJoinResponseMutex sync.RWMutex
sendJoinResponseArgsForCall []struct { sendJoinResponseArgsForCall []struct {
@@ -167,17 +180,6 @@ type FakeParticipant struct {
sendParticipantUpdateReturnsOnCall map[int]struct { sendParticipantUpdateReturnsOnCall map[int]struct {
result1 error result1 error
} }
SetRemoteDescriptionStub func(webrtc.SessionDescription) error
setRemoteDescriptionMutex sync.RWMutex
setRemoteDescriptionArgsForCall []struct {
arg1 webrtc.SessionDescription
}
setRemoteDescriptionReturns struct {
result1 error
}
setRemoteDescriptionReturnsOnCall map[int]struct {
result1 error
}
SetTrackMutedStub func(string, bool) SetTrackMutedStub func(string, bool)
setTrackMutedMutex sync.RWMutex setTrackMutedMutex sync.RWMutex
setTrackMutedArgsForCall []struct { setTrackMutedArgsForCall []struct {
@@ -367,6 +369,40 @@ func (fake *FakeParticipant) AddSubscriberReturnsOnCall(i int, result1 error) {
}{result1} }{result1}
} }
func (fake *FakeParticipant) AddTrack(arg1 string, arg2 string, arg3 livekit.TrackType) {
fake.addTrackMutex.Lock()
fake.addTrackArgsForCall = append(fake.addTrackArgsForCall, struct {
arg1 string
arg2 string
arg3 livekit.TrackType
}{arg1, arg2, arg3})
stub := fake.AddTrackStub
fake.recordInvocation("AddTrack", []interface{}{arg1, arg2, arg3})
fake.addTrackMutex.Unlock()
if stub != nil {
fake.AddTrackStub(arg1, arg2, arg3)
}
}
func (fake *FakeParticipant) AddTrackCallCount() int {
fake.addTrackMutex.RLock()
defer fake.addTrackMutex.RUnlock()
return len(fake.addTrackArgsForCall)
}
func (fake *FakeParticipant) AddTrackCalls(stub func(string, string, livekit.TrackType)) {
fake.addTrackMutex.Lock()
defer fake.addTrackMutex.Unlock()
fake.AddTrackStub = stub
}
func (fake *FakeParticipant) AddTrackArgsForCall(i int) (string, string, livekit.TrackType) {
fake.addTrackMutex.RLock()
defer fake.addTrackMutex.RUnlock()
argsForCall := fake.addTrackArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *FakeParticipant) Answer(arg1 webrtc.SessionDescription) (webrtc.SessionDescription, error) { func (fake *FakeParticipant) Answer(arg1 webrtc.SessionDescription) (webrtc.SessionDescription, error) {
fake.answerMutex.Lock() fake.answerMutex.Lock()
ret, specificReturn := fake.answerReturnsOnCall[len(fake.answerArgsForCall)] ret, specificReturn := fake.answerReturnsOnCall[len(fake.answerArgsForCall)]
@@ -484,16 +520,16 @@ func (fake *FakeParticipant) CloseReturnsOnCall(i int, result1 error) {
}{result1} }{result1}
} }
func (fake *FakeParticipant) HandleNegotiate(arg1 webrtc.SessionDescription) error { func (fake *FakeParticipant) HandleAnswer(arg1 webrtc.SessionDescription) error {
fake.handleNegotiateMutex.Lock() fake.handleAnswerMutex.Lock()
ret, specificReturn := fake.handleNegotiateReturnsOnCall[len(fake.handleNegotiateArgsForCall)] ret, specificReturn := fake.handleAnswerReturnsOnCall[len(fake.handleAnswerArgsForCall)]
fake.handleNegotiateArgsForCall = append(fake.handleNegotiateArgsForCall, struct { fake.handleAnswerArgsForCall = append(fake.handleAnswerArgsForCall, struct {
arg1 webrtc.SessionDescription arg1 webrtc.SessionDescription
}{arg1}) }{arg1})
stub := fake.HandleNegotiateStub stub := fake.HandleAnswerStub
fakeReturns := fake.handleNegotiateReturns fakeReturns := fake.handleAnswerReturns
fake.recordInvocation("HandleNegotiate", []interface{}{arg1}) fake.recordInvocation("HandleAnswer", []interface{}{arg1})
fake.handleNegotiateMutex.Unlock() fake.handleAnswerMutex.Unlock()
if stub != nil { if stub != nil {
return stub(arg1) return stub(arg1)
} }
@@ -503,44 +539,44 @@ func (fake *FakeParticipant) HandleNegotiate(arg1 webrtc.SessionDescription) err
return fakeReturns.result1 return fakeReturns.result1
} }
func (fake *FakeParticipant) HandleNegotiateCallCount() int { func (fake *FakeParticipant) HandleAnswerCallCount() int {
fake.handleNegotiateMutex.RLock() fake.handleAnswerMutex.RLock()
defer fake.handleNegotiateMutex.RUnlock() defer fake.handleAnswerMutex.RUnlock()
return len(fake.handleNegotiateArgsForCall) return len(fake.handleAnswerArgsForCall)
} }
func (fake *FakeParticipant) HandleNegotiateCalls(stub func(webrtc.SessionDescription) error) { func (fake *FakeParticipant) HandleAnswerCalls(stub func(webrtc.SessionDescription) error) {
fake.handleNegotiateMutex.Lock() fake.handleAnswerMutex.Lock()
defer fake.handleNegotiateMutex.Unlock() defer fake.handleAnswerMutex.Unlock()
fake.HandleNegotiateStub = stub fake.HandleAnswerStub = stub
} }
func (fake *FakeParticipant) HandleNegotiateArgsForCall(i int) webrtc.SessionDescription { func (fake *FakeParticipant) HandleAnswerArgsForCall(i int) webrtc.SessionDescription {
fake.handleNegotiateMutex.RLock() fake.handleAnswerMutex.RLock()
defer fake.handleNegotiateMutex.RUnlock() defer fake.handleAnswerMutex.RUnlock()
argsForCall := fake.handleNegotiateArgsForCall[i] argsForCall := fake.handleAnswerArgsForCall[i]
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeParticipant) HandleNegotiateReturns(result1 error) { func (fake *FakeParticipant) HandleAnswerReturns(result1 error) {
fake.handleNegotiateMutex.Lock() fake.handleAnswerMutex.Lock()
defer fake.handleNegotiateMutex.Unlock() defer fake.handleAnswerMutex.Unlock()
fake.HandleNegotiateStub = nil fake.HandleAnswerStub = nil
fake.handleNegotiateReturns = struct { fake.handleAnswerReturns = struct {
result1 error result1 error
}{result1} }{result1}
} }
func (fake *FakeParticipant) HandleNegotiateReturnsOnCall(i int, result1 error) { func (fake *FakeParticipant) HandleAnswerReturnsOnCall(i int, result1 error) {
fake.handleNegotiateMutex.Lock() fake.handleAnswerMutex.Lock()
defer fake.handleNegotiateMutex.Unlock() defer fake.handleAnswerMutex.Unlock()
fake.HandleNegotiateStub = nil fake.HandleAnswerStub = nil
if fake.handleNegotiateReturnsOnCall == nil { if fake.handleAnswerReturnsOnCall == nil {
fake.handleNegotiateReturnsOnCall = make(map[int]struct { fake.handleAnswerReturnsOnCall = make(map[int]struct {
result1 error result1 error
}) })
} }
fake.handleNegotiateReturnsOnCall[i] = struct { fake.handleAnswerReturnsOnCall[i] = struct {
result1 error result1 error
}{result1} }{result1}
} }
@@ -715,38 +751,6 @@ func (fake *FakeParticipant) OnICECandidateArgsForCall(i int) func(c *webrtc.ICE
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeParticipant) OnOffer(arg1 func(webrtc.SessionDescription)) {
fake.onOfferMutex.Lock()
fake.onOfferArgsForCall = append(fake.onOfferArgsForCall, struct {
arg1 func(webrtc.SessionDescription)
}{arg1})
stub := fake.OnOfferStub
fake.recordInvocation("OnOffer", []interface{}{arg1})
fake.onOfferMutex.Unlock()
if stub != nil {
fake.OnOfferStub(arg1)
}
}
func (fake *FakeParticipant) OnOfferCallCount() int {
fake.onOfferMutex.RLock()
defer fake.onOfferMutex.RUnlock()
return len(fake.onOfferArgsForCall)
}
func (fake *FakeParticipant) OnOfferCalls(stub func(func(webrtc.SessionDescription))) {
fake.onOfferMutex.Lock()
defer fake.onOfferMutex.Unlock()
fake.OnOfferStub = stub
}
func (fake *FakeParticipant) OnOfferArgsForCall(i int) func(webrtc.SessionDescription) {
fake.onOfferMutex.RLock()
defer fake.onOfferMutex.RUnlock()
argsForCall := fake.onOfferArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeParticipant) OnStateChange(arg1 func(p types.Participant, oldState livekit.ParticipantInfo_State)) { func (fake *FakeParticipant) OnStateChange(arg1 func(p types.Participant, oldState livekit.ParticipantInfo_State)) {
fake.onStateChangeMutex.Lock() fake.onStateChangeMutex.Lock()
fake.onStateChangeArgsForCall = append(fake.onStateChangeArgsForCall, struct { fake.onStateChangeArgsForCall = append(fake.onStateChangeArgsForCall, struct {
@@ -961,6 +965,67 @@ func (fake *FakeParticipant) RemoveSubscriberArgsForCall(i int) string {
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeParticipant) RemoveTrack(arg1 string) error {
fake.removeTrackMutex.Lock()
ret, specificReturn := fake.removeTrackReturnsOnCall[len(fake.removeTrackArgsForCall)]
fake.removeTrackArgsForCall = append(fake.removeTrackArgsForCall, struct {
arg1 string
}{arg1})
stub := fake.RemoveTrackStub
fakeReturns := fake.removeTrackReturns
fake.recordInvocation("RemoveTrack", []interface{}{arg1})
fake.removeTrackMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeParticipant) RemoveTrackCallCount() int {
fake.removeTrackMutex.RLock()
defer fake.removeTrackMutex.RUnlock()
return len(fake.removeTrackArgsForCall)
}
func (fake *FakeParticipant) RemoveTrackCalls(stub func(string) error) {
fake.removeTrackMutex.Lock()
defer fake.removeTrackMutex.Unlock()
fake.RemoveTrackStub = stub
}
func (fake *FakeParticipant) RemoveTrackArgsForCall(i int) string {
fake.removeTrackMutex.RLock()
defer fake.removeTrackMutex.RUnlock()
argsForCall := fake.removeTrackArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeParticipant) RemoveTrackReturns(result1 error) {
fake.removeTrackMutex.Lock()
defer fake.removeTrackMutex.Unlock()
fake.RemoveTrackStub = nil
fake.removeTrackReturns = struct {
result1 error
}{result1}
}
func (fake *FakeParticipant) RemoveTrackReturnsOnCall(i int, result1 error) {
fake.removeTrackMutex.Lock()
defer fake.removeTrackMutex.Unlock()
fake.RemoveTrackStub = nil
if fake.removeTrackReturnsOnCall == nil {
fake.removeTrackReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.removeTrackReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeParticipant) SendJoinResponse(arg1 *livekit.RoomInfo, arg2 []types.Participant) error { func (fake *FakeParticipant) SendJoinResponse(arg1 *livekit.RoomInfo, arg2 []types.Participant) error {
var arg2Copy []types.Participant var arg2Copy []types.Participant
if arg2 != nil { if arg2 != nil {
@@ -1094,67 +1159,6 @@ func (fake *FakeParticipant) SendParticipantUpdateReturnsOnCall(i int, result1 e
}{result1} }{result1}
} }
func (fake *FakeParticipant) SetRemoteDescription(arg1 webrtc.SessionDescription) error {
fake.setRemoteDescriptionMutex.Lock()
ret, specificReturn := fake.setRemoteDescriptionReturnsOnCall[len(fake.setRemoteDescriptionArgsForCall)]
fake.setRemoteDescriptionArgsForCall = append(fake.setRemoteDescriptionArgsForCall, struct {
arg1 webrtc.SessionDescription
}{arg1})
stub := fake.SetRemoteDescriptionStub
fakeReturns := fake.setRemoteDescriptionReturns
fake.recordInvocation("SetRemoteDescription", []interface{}{arg1})
fake.setRemoteDescriptionMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeParticipant) SetRemoteDescriptionCallCount() int {
fake.setRemoteDescriptionMutex.RLock()
defer fake.setRemoteDescriptionMutex.RUnlock()
return len(fake.setRemoteDescriptionArgsForCall)
}
func (fake *FakeParticipant) SetRemoteDescriptionCalls(stub func(webrtc.SessionDescription) error) {
fake.setRemoteDescriptionMutex.Lock()
defer fake.setRemoteDescriptionMutex.Unlock()
fake.SetRemoteDescriptionStub = stub
}
func (fake *FakeParticipant) SetRemoteDescriptionArgsForCall(i int) webrtc.SessionDescription {
fake.setRemoteDescriptionMutex.RLock()
defer fake.setRemoteDescriptionMutex.RUnlock()
argsForCall := fake.setRemoteDescriptionArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeParticipant) SetRemoteDescriptionReturns(result1 error) {
fake.setRemoteDescriptionMutex.Lock()
defer fake.setRemoteDescriptionMutex.Unlock()
fake.SetRemoteDescriptionStub = nil
fake.setRemoteDescriptionReturns = struct {
result1 error
}{result1}
}
func (fake *FakeParticipant) SetRemoteDescriptionReturnsOnCall(i int, result1 error) {
fake.setRemoteDescriptionMutex.Lock()
defer fake.setRemoteDescriptionMutex.Unlock()
fake.SetRemoteDescriptionStub = nil
if fake.setRemoteDescriptionReturnsOnCall == nil {
fake.setRemoteDescriptionReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.setRemoteDescriptionReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeParticipant) SetTrackMuted(arg1 string, arg2 bool) { func (fake *FakeParticipant) SetTrackMuted(arg1 string, arg2 bool) {
fake.setTrackMutedMutex.Lock() fake.setTrackMutedMutex.Lock()
fake.setTrackMutedArgsForCall = append(fake.setTrackMutedArgsForCall, struct { fake.setTrackMutedArgsForCall = append(fake.setTrackMutedArgsForCall, struct {
@@ -1327,12 +1331,14 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
defer fake.addICECandidateMutex.RUnlock() defer fake.addICECandidateMutex.RUnlock()
fake.addSubscriberMutex.RLock() fake.addSubscriberMutex.RLock()
defer fake.addSubscriberMutex.RUnlock() defer fake.addSubscriberMutex.RUnlock()
fake.addTrackMutex.RLock()
defer fake.addTrackMutex.RUnlock()
fake.answerMutex.RLock() fake.answerMutex.RLock()
defer fake.answerMutex.RUnlock() defer fake.answerMutex.RUnlock()
fake.closeMutex.RLock() fake.closeMutex.RLock()
defer fake.closeMutex.RUnlock() defer fake.closeMutex.RUnlock()
fake.handleNegotiateMutex.RLock() fake.handleAnswerMutex.RLock()
defer fake.handleNegotiateMutex.RUnlock() defer fake.handleAnswerMutex.RUnlock()
fake.iDMutex.RLock() fake.iDMutex.RLock()
defer fake.iDMutex.RUnlock() defer fake.iDMutex.RUnlock()
fake.nameMutex.RLock() fake.nameMutex.RLock()
@@ -1341,8 +1347,6 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
defer fake.onCloseMutex.RUnlock() defer fake.onCloseMutex.RUnlock()
fake.onICECandidateMutex.RLock() fake.onICECandidateMutex.RLock()
defer fake.onICECandidateMutex.RUnlock() defer fake.onICECandidateMutex.RUnlock()
fake.onOfferMutex.RLock()
defer fake.onOfferMutex.RUnlock()
fake.onStateChangeMutex.RLock() fake.onStateChangeMutex.RLock()
defer fake.onStateChangeMutex.RUnlock() defer fake.onStateChangeMutex.RUnlock()
fake.onTrackPublishedMutex.RLock() fake.onTrackPublishedMutex.RLock()
@@ -1355,12 +1359,12 @@ func (fake *FakeParticipant) Invocations() map[string][][]interface{} {
defer fake.removeDownTrackMutex.RUnlock() defer fake.removeDownTrackMutex.RUnlock()
fake.removeSubscriberMutex.RLock() fake.removeSubscriberMutex.RLock()
defer fake.removeSubscriberMutex.RUnlock() defer fake.removeSubscriberMutex.RUnlock()
fake.removeTrackMutex.RLock()
defer fake.removeTrackMutex.RUnlock()
fake.sendJoinResponseMutex.RLock() fake.sendJoinResponseMutex.RLock()
defer fake.sendJoinResponseMutex.RUnlock() defer fake.sendJoinResponseMutex.RUnlock()
fake.sendParticipantUpdateMutex.RLock() fake.sendParticipantUpdateMutex.RLock()
defer fake.sendParticipantUpdateMutex.RUnlock() defer fake.sendParticipantUpdateMutex.RUnlock()
fake.setRemoteDescriptionMutex.RLock()
defer fake.setRemoteDescriptionMutex.RUnlock()
fake.setTrackMutedMutex.RLock() fake.setTrackMutedMutex.RLock()
defer fake.setTrackMutedMutex.RUnlock() defer fake.setTrackMutedMutex.RUnlock()
fake.startMutex.RLock() fake.startMutex.RLock()
@@ -153,6 +153,16 @@ type FakePeerConnection struct {
setRemoteDescriptionReturnsOnCall map[int]struct { setRemoteDescriptionReturnsOnCall map[int]struct {
result1 error result1 error
} }
SignalingStateStub func() webrtc.SignalingState
signalingStateMutex sync.RWMutex
signalingStateArgsForCall []struct {
}
signalingStateReturns struct {
result1 webrtc.SignalingState
}
signalingStateReturnsOnCall map[int]struct {
result1 webrtc.SignalingState
}
WriteRTCPStub func([]rtcp.Packet) error WriteRTCPStub func([]rtcp.Packet) error
writeRTCPMutex sync.RWMutex writeRTCPMutex sync.RWMutex
writeRTCPArgsForCall []struct { writeRTCPArgsForCall []struct {
@@ -936,6 +946,59 @@ func (fake *FakePeerConnection) SetRemoteDescriptionReturnsOnCall(i int, result1
}{result1} }{result1}
} }
func (fake *FakePeerConnection) SignalingState() webrtc.SignalingState {
fake.signalingStateMutex.Lock()
ret, specificReturn := fake.signalingStateReturnsOnCall[len(fake.signalingStateArgsForCall)]
fake.signalingStateArgsForCall = append(fake.signalingStateArgsForCall, struct {
}{})
stub := fake.SignalingStateStub
fakeReturns := fake.signalingStateReturns
fake.recordInvocation("SignalingState", []interface{}{})
fake.signalingStateMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakePeerConnection) SignalingStateCallCount() int {
fake.signalingStateMutex.RLock()
defer fake.signalingStateMutex.RUnlock()
return len(fake.signalingStateArgsForCall)
}
func (fake *FakePeerConnection) SignalingStateCalls(stub func() webrtc.SignalingState) {
fake.signalingStateMutex.Lock()
defer fake.signalingStateMutex.Unlock()
fake.SignalingStateStub = stub
}
func (fake *FakePeerConnection) SignalingStateReturns(result1 webrtc.SignalingState) {
fake.signalingStateMutex.Lock()
defer fake.signalingStateMutex.Unlock()
fake.SignalingStateStub = nil
fake.signalingStateReturns = struct {
result1 webrtc.SignalingState
}{result1}
}
func (fake *FakePeerConnection) SignalingStateReturnsOnCall(i int, result1 webrtc.SignalingState) {
fake.signalingStateMutex.Lock()
defer fake.signalingStateMutex.Unlock()
fake.SignalingStateStub = nil
if fake.signalingStateReturnsOnCall == nil {
fake.signalingStateReturnsOnCall = make(map[int]struct {
result1 webrtc.SignalingState
})
}
fake.signalingStateReturnsOnCall[i] = struct {
result1 webrtc.SignalingState
}{result1}
}
func (fake *FakePeerConnection) WriteRTCP(arg1 []rtcp.Packet) error { func (fake *FakePeerConnection) WriteRTCP(arg1 []rtcp.Packet) error {
var arg1Copy []rtcp.Packet var arg1Copy []rtcp.Packet
if arg1 != nil { if arg1 != nil {
@@ -1035,6 +1098,8 @@ func (fake *FakePeerConnection) Invocations() map[string][][]interface{} {
defer fake.setLocalDescriptionMutex.RUnlock() defer fake.setLocalDescriptionMutex.RUnlock()
fake.setRemoteDescriptionMutex.RLock() fake.setRemoteDescriptionMutex.RLock()
defer fake.setRemoteDescriptionMutex.RUnlock() defer fake.setRemoteDescriptionMutex.RUnlock()
fake.signalingStateMutex.RLock()
defer fake.signalingStateMutex.RUnlock()
fake.writeRTCPMutex.RLock() fake.writeRTCPMutex.RLock()
defer fake.writeRTCPMutex.RUnlock() defer fake.writeRTCPMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{} copiedInvocations := map[string][][]interface{}{}
+114 -75
View File
@@ -40,15 +40,25 @@ type FakePublishedTrack struct {
isMutedReturnsOnCall map[int]struct { isMutedReturnsOnCall map[int]struct {
result1 bool result1 bool
} }
KindStub func() livekit.TrackInfo_Type KindStub func() livekit.TrackType
kindMutex sync.RWMutex kindMutex sync.RWMutex
kindArgsForCall []struct { kindArgsForCall []struct {
} }
kindReturns struct { kindReturns struct {
result1 livekit.TrackInfo_Type result1 livekit.TrackType
} }
kindReturnsOnCall map[int]struct { kindReturnsOnCall map[int]struct {
result1 livekit.TrackInfo_Type result1 livekit.TrackType
}
NameStub func() string
nameMutex sync.RWMutex
nameArgsForCall []struct {
}
nameReturns struct {
result1 string
}
nameReturnsOnCall map[int]struct {
result1 string
} }
RemoveAllSubscribersStub func() RemoveAllSubscribersStub func()
removeAllSubscribersMutex sync.RWMutex removeAllSubscribersMutex sync.RWMutex
@@ -59,20 +69,15 @@ type FakePublishedTrack struct {
removeSubscriberArgsForCall []struct { removeSubscriberArgsForCall []struct {
arg1 string arg1 string
} }
SetNameStub func(string)
setNameMutex sync.RWMutex
setNameArgsForCall []struct {
arg1 string
}
StartStub func() StartStub func()
startMutex sync.RWMutex startMutex sync.RWMutex
startArgsForCall []struct { startArgsForCall []struct {
} }
StreamIDStub func() string
streamIDMutex sync.RWMutex
streamIDArgsForCall []struct {
}
streamIDReturns struct {
result1 string
}
streamIDReturnsOnCall map[int]struct {
result1 string
}
invocations map[string][][]interface{} invocations map[string][][]interface{}
invocationsMutex sync.RWMutex invocationsMutex sync.RWMutex
} }
@@ -244,7 +249,7 @@ func (fake *FakePublishedTrack) IsMutedReturnsOnCall(i int, result1 bool) {
}{result1} }{result1}
} }
func (fake *FakePublishedTrack) Kind() livekit.TrackInfo_Type { func (fake *FakePublishedTrack) Kind() livekit.TrackType {
fake.kindMutex.Lock() fake.kindMutex.Lock()
ret, specificReturn := fake.kindReturnsOnCall[len(fake.kindArgsForCall)] ret, specificReturn := fake.kindReturnsOnCall[len(fake.kindArgsForCall)]
fake.kindArgsForCall = append(fake.kindArgsForCall, struct { fake.kindArgsForCall = append(fake.kindArgsForCall, struct {
@@ -268,32 +273,85 @@ func (fake *FakePublishedTrack) KindCallCount() int {
return len(fake.kindArgsForCall) return len(fake.kindArgsForCall)
} }
func (fake *FakePublishedTrack) KindCalls(stub func() livekit.TrackInfo_Type) { func (fake *FakePublishedTrack) KindCalls(stub func() livekit.TrackType) {
fake.kindMutex.Lock() fake.kindMutex.Lock()
defer fake.kindMutex.Unlock() defer fake.kindMutex.Unlock()
fake.KindStub = stub fake.KindStub = stub
} }
func (fake *FakePublishedTrack) KindReturns(result1 livekit.TrackInfo_Type) { func (fake *FakePublishedTrack) KindReturns(result1 livekit.TrackType) {
fake.kindMutex.Lock() fake.kindMutex.Lock()
defer fake.kindMutex.Unlock() defer fake.kindMutex.Unlock()
fake.KindStub = nil fake.KindStub = nil
fake.kindReturns = struct { fake.kindReturns = struct {
result1 livekit.TrackInfo_Type result1 livekit.TrackType
}{result1} }{result1}
} }
func (fake *FakePublishedTrack) KindReturnsOnCall(i int, result1 livekit.TrackInfo_Type) { func (fake *FakePublishedTrack) KindReturnsOnCall(i int, result1 livekit.TrackType) {
fake.kindMutex.Lock() fake.kindMutex.Lock()
defer fake.kindMutex.Unlock() defer fake.kindMutex.Unlock()
fake.KindStub = nil fake.KindStub = nil
if fake.kindReturnsOnCall == nil { if fake.kindReturnsOnCall == nil {
fake.kindReturnsOnCall = make(map[int]struct { fake.kindReturnsOnCall = make(map[int]struct {
result1 livekit.TrackInfo_Type result1 livekit.TrackType
}) })
} }
fake.kindReturnsOnCall[i] = struct { fake.kindReturnsOnCall[i] = struct {
result1 livekit.TrackInfo_Type result1 livekit.TrackType
}{result1}
}
func (fake *FakePublishedTrack) Name() string {
fake.nameMutex.Lock()
ret, specificReturn := fake.nameReturnsOnCall[len(fake.nameArgsForCall)]
fake.nameArgsForCall = append(fake.nameArgsForCall, struct {
}{})
stub := fake.NameStub
fakeReturns := fake.nameReturns
fake.recordInvocation("Name", []interface{}{})
fake.nameMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakePublishedTrack) NameCallCount() int {
fake.nameMutex.RLock()
defer fake.nameMutex.RUnlock()
return len(fake.nameArgsForCall)
}
func (fake *FakePublishedTrack) NameCalls(stub func() string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = stub
}
func (fake *FakePublishedTrack) NameReturns(result1 string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = nil
fake.nameReturns = struct {
result1 string
}{result1}
}
func (fake *FakePublishedTrack) NameReturnsOnCall(i int, result1 string) {
fake.nameMutex.Lock()
defer fake.nameMutex.Unlock()
fake.NameStub = nil
if fake.nameReturnsOnCall == nil {
fake.nameReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.nameReturnsOnCall[i] = struct {
result1 string
}{result1} }{result1}
} }
@@ -353,6 +411,38 @@ func (fake *FakePublishedTrack) RemoveSubscriberArgsForCall(i int) string {
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakePublishedTrack) SetName(arg1 string) {
fake.setNameMutex.Lock()
fake.setNameArgsForCall = append(fake.setNameArgsForCall, struct {
arg1 string
}{arg1})
stub := fake.SetNameStub
fake.recordInvocation("SetName", []interface{}{arg1})
fake.setNameMutex.Unlock()
if stub != nil {
fake.SetNameStub(arg1)
}
}
func (fake *FakePublishedTrack) SetNameCallCount() int {
fake.setNameMutex.RLock()
defer fake.setNameMutex.RUnlock()
return len(fake.setNameArgsForCall)
}
func (fake *FakePublishedTrack) SetNameCalls(stub func(string)) {
fake.setNameMutex.Lock()
defer fake.setNameMutex.Unlock()
fake.SetNameStub = stub
}
func (fake *FakePublishedTrack) SetNameArgsForCall(i int) string {
fake.setNameMutex.RLock()
defer fake.setNameMutex.RUnlock()
argsForCall := fake.setNameArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakePublishedTrack) Start() { func (fake *FakePublishedTrack) Start() {
fake.startMutex.Lock() fake.startMutex.Lock()
fake.startArgsForCall = append(fake.startArgsForCall, struct { fake.startArgsForCall = append(fake.startArgsForCall, struct {
@@ -377,59 +467,6 @@ func (fake *FakePublishedTrack) StartCalls(stub func()) {
fake.StartStub = stub fake.StartStub = stub
} }
func (fake *FakePublishedTrack) StreamID() string {
fake.streamIDMutex.Lock()
ret, specificReturn := fake.streamIDReturnsOnCall[len(fake.streamIDArgsForCall)]
fake.streamIDArgsForCall = append(fake.streamIDArgsForCall, struct {
}{})
stub := fake.StreamIDStub
fakeReturns := fake.streamIDReturns
fake.recordInvocation("StreamID", []interface{}{})
fake.streamIDMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakePublishedTrack) StreamIDCallCount() int {
fake.streamIDMutex.RLock()
defer fake.streamIDMutex.RUnlock()
return len(fake.streamIDArgsForCall)
}
func (fake *FakePublishedTrack) StreamIDCalls(stub func() string) {
fake.streamIDMutex.Lock()
defer fake.streamIDMutex.Unlock()
fake.StreamIDStub = stub
}
func (fake *FakePublishedTrack) StreamIDReturns(result1 string) {
fake.streamIDMutex.Lock()
defer fake.streamIDMutex.Unlock()
fake.StreamIDStub = nil
fake.streamIDReturns = struct {
result1 string
}{result1}
}
func (fake *FakePublishedTrack) StreamIDReturnsOnCall(i int, result1 string) {
fake.streamIDMutex.Lock()
defer fake.streamIDMutex.Unlock()
fake.StreamIDStub = nil
if fake.streamIDReturnsOnCall == nil {
fake.streamIDReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.streamIDReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *FakePublishedTrack) Invocations() map[string][][]interface{} { func (fake *FakePublishedTrack) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock() fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock() defer fake.invocationsMutex.RUnlock()
@@ -441,14 +478,16 @@ func (fake *FakePublishedTrack) Invocations() map[string][][]interface{} {
defer fake.isMutedMutex.RUnlock() defer fake.isMutedMutex.RUnlock()
fake.kindMutex.RLock() fake.kindMutex.RLock()
defer fake.kindMutex.RUnlock() defer fake.kindMutex.RUnlock()
fake.nameMutex.RLock()
defer fake.nameMutex.RUnlock()
fake.removeAllSubscribersMutex.RLock() fake.removeAllSubscribersMutex.RLock()
defer fake.removeAllSubscribersMutex.RUnlock() defer fake.removeAllSubscribersMutex.RUnlock()
fake.removeSubscriberMutex.RLock() fake.removeSubscriberMutex.RLock()
defer fake.removeSubscriberMutex.RUnlock() defer fake.removeSubscriberMutex.RUnlock()
fake.setNameMutex.RLock()
defer fake.setNameMutex.RUnlock()
fake.startMutex.RLock() fake.startMutex.RLock()
defer fake.startMutex.RUnlock() defer fake.startMutex.RUnlock()
fake.streamIDMutex.RLock()
defer fake.streamIDMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{} copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations { for key, value := range fake.invocations {
copiedInvocations[key] = value copiedInvocations[key] = value
+97 -194
View File
@@ -9,130 +9,54 @@ import (
) )
type FakeReceiver struct { type FakeReceiver struct {
GetBufferedPacketsStub func(uint32, uint16, uint32, []uint16) []rtp.Packet GetBufferedPacketStub func([]byte, uint16, uint16) (rtp.Packet, error)
getBufferedPacketsMutex sync.RWMutex getBufferedPacketMutex sync.RWMutex
getBufferedPacketsArgsForCall []struct { getBufferedPacketArgsForCall []struct {
arg1 uint32 arg1 []byte
arg2 uint16 arg2 uint16
arg3 uint32 arg3 uint16
arg4 []uint16
} }
getBufferedPacketsReturns struct { getBufferedPacketReturns struct {
result1 []rtp.Packet result1 rtp.Packet
}
getBufferedPacketsReturnsOnCall map[int]struct {
result1 []rtp.Packet
}
ReadRTPStub func() (*rtp.Packet, error)
readRTPMutex sync.RWMutex
readRTPArgsForCall []struct {
}
readRTPReturns struct {
result1 *rtp.Packet
result2 error result2 error
} }
readRTPReturnsOnCall map[int]struct { getBufferedPacketReturnsOnCall map[int]struct {
result1 *rtp.Packet result1 rtp.Packet
result2 error result2 error
} }
StartStub func() RTPChanStub func() <-chan rtp.Packet
startMutex sync.RWMutex rTPChanMutex sync.RWMutex
startArgsForCall []struct { rTPChanArgsForCall []struct {
} }
TrackIdStub func() string rTPChanReturns struct {
trackIdMutex sync.RWMutex result1 <-chan rtp.Packet
trackIdArgsForCall []struct {
} }
trackIdReturns struct { rTPChanReturnsOnCall map[int]struct {
result1 string result1 <-chan rtp.Packet
}
trackIdReturnsOnCall map[int]struct {
result1 string
} }
invocations map[string][][]interface{} invocations map[string][][]interface{}
invocationsMutex sync.RWMutex invocationsMutex sync.RWMutex
} }
func (fake *FakeReceiver) GetBufferedPackets(arg1 uint32, arg2 uint16, arg3 uint32, arg4 []uint16) []rtp.Packet { func (fake *FakeReceiver) GetBufferedPacket(arg1 []byte, arg2 uint16, arg3 uint16) (rtp.Packet, error) {
var arg4Copy []uint16 var arg1Copy []byte
if arg4 != nil { if arg1 != nil {
arg4Copy = make([]uint16, len(arg4)) arg1Copy = make([]byte, len(arg1))
copy(arg4Copy, arg4) copy(arg1Copy, arg1)
} }
fake.getBufferedPacketsMutex.Lock() fake.getBufferedPacketMutex.Lock()
ret, specificReturn := fake.getBufferedPacketsReturnsOnCall[len(fake.getBufferedPacketsArgsForCall)] ret, specificReturn := fake.getBufferedPacketReturnsOnCall[len(fake.getBufferedPacketArgsForCall)]
fake.getBufferedPacketsArgsForCall = append(fake.getBufferedPacketsArgsForCall, struct { fake.getBufferedPacketArgsForCall = append(fake.getBufferedPacketArgsForCall, struct {
arg1 uint32 arg1 []byte
arg2 uint16 arg2 uint16
arg3 uint32 arg3 uint16
arg4 []uint16 }{arg1Copy, arg2, arg3})
}{arg1, arg2, arg3, arg4Copy}) stub := fake.GetBufferedPacketStub
stub := fake.GetBufferedPacketsStub fakeReturns := fake.getBufferedPacketReturns
fakeReturns := fake.getBufferedPacketsReturns fake.recordInvocation("GetBufferedPacket", []interface{}{arg1Copy, arg2, arg3})
fake.recordInvocation("GetBufferedPackets", []interface{}{arg1, arg2, arg3, arg4Copy}) fake.getBufferedPacketMutex.Unlock()
fake.getBufferedPacketsMutex.Unlock()
if stub != nil { if stub != nil {
return stub(arg1, arg2, arg3, arg4) return stub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeReceiver) GetBufferedPacketsCallCount() int {
fake.getBufferedPacketsMutex.RLock()
defer fake.getBufferedPacketsMutex.RUnlock()
return len(fake.getBufferedPacketsArgsForCall)
}
func (fake *FakeReceiver) GetBufferedPacketsCalls(stub func(uint32, uint16, uint32, []uint16) []rtp.Packet) {
fake.getBufferedPacketsMutex.Lock()
defer fake.getBufferedPacketsMutex.Unlock()
fake.GetBufferedPacketsStub = stub
}
func (fake *FakeReceiver) GetBufferedPacketsArgsForCall(i int) (uint32, uint16, uint32, []uint16) {
fake.getBufferedPacketsMutex.RLock()
defer fake.getBufferedPacketsMutex.RUnlock()
argsForCall := fake.getBufferedPacketsArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakeReceiver) GetBufferedPacketsReturns(result1 []rtp.Packet) {
fake.getBufferedPacketsMutex.Lock()
defer fake.getBufferedPacketsMutex.Unlock()
fake.GetBufferedPacketsStub = nil
fake.getBufferedPacketsReturns = struct {
result1 []rtp.Packet
}{result1}
}
func (fake *FakeReceiver) GetBufferedPacketsReturnsOnCall(i int, result1 []rtp.Packet) {
fake.getBufferedPacketsMutex.Lock()
defer fake.getBufferedPacketsMutex.Unlock()
fake.GetBufferedPacketsStub = nil
if fake.getBufferedPacketsReturnsOnCall == nil {
fake.getBufferedPacketsReturnsOnCall = make(map[int]struct {
result1 []rtp.Packet
})
}
fake.getBufferedPacketsReturnsOnCall[i] = struct {
result1 []rtp.Packet
}{result1}
}
func (fake *FakeReceiver) ReadRTP() (*rtp.Packet, error) {
fake.readRTPMutex.Lock()
ret, specificReturn := fake.readRTPReturnsOnCall[len(fake.readRTPArgsForCall)]
fake.readRTPArgsForCall = append(fake.readRTPArgsForCall, struct {
}{})
stub := fake.ReadRTPStub
fakeReturns := fake.readRTPReturns
fake.recordInvocation("ReadRTP", []interface{}{})
fake.readRTPMutex.Unlock()
if stub != nil {
return stub()
} }
if specificReturn { if specificReturn {
return ret.result1, ret.result2 return ret.result1, ret.result2
@@ -140,77 +64,60 @@ func (fake *FakeReceiver) ReadRTP() (*rtp.Packet, error) {
return fakeReturns.result1, fakeReturns.result2 return fakeReturns.result1, fakeReturns.result2
} }
func (fake *FakeReceiver) ReadRTPCallCount() int { func (fake *FakeReceiver) GetBufferedPacketCallCount() int {
fake.readRTPMutex.RLock() fake.getBufferedPacketMutex.RLock()
defer fake.readRTPMutex.RUnlock() defer fake.getBufferedPacketMutex.RUnlock()
return len(fake.readRTPArgsForCall) return len(fake.getBufferedPacketArgsForCall)
} }
func (fake *FakeReceiver) ReadRTPCalls(stub func() (*rtp.Packet, error)) { func (fake *FakeReceiver) GetBufferedPacketCalls(stub func([]byte, uint16, uint16) (rtp.Packet, error)) {
fake.readRTPMutex.Lock() fake.getBufferedPacketMutex.Lock()
defer fake.readRTPMutex.Unlock() defer fake.getBufferedPacketMutex.Unlock()
fake.ReadRTPStub = stub fake.GetBufferedPacketStub = stub
} }
func (fake *FakeReceiver) ReadRTPReturns(result1 *rtp.Packet, result2 error) { func (fake *FakeReceiver) GetBufferedPacketArgsForCall(i int) ([]byte, uint16, uint16) {
fake.readRTPMutex.Lock() fake.getBufferedPacketMutex.RLock()
defer fake.readRTPMutex.Unlock() defer fake.getBufferedPacketMutex.RUnlock()
fake.ReadRTPStub = nil argsForCall := fake.getBufferedPacketArgsForCall[i]
fake.readRTPReturns = struct { return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
result1 *rtp.Packet }
func (fake *FakeReceiver) GetBufferedPacketReturns(result1 rtp.Packet, result2 error) {
fake.getBufferedPacketMutex.Lock()
defer fake.getBufferedPacketMutex.Unlock()
fake.GetBufferedPacketStub = nil
fake.getBufferedPacketReturns = struct {
result1 rtp.Packet
result2 error result2 error
}{result1, result2} }{result1, result2}
} }
func (fake *FakeReceiver) ReadRTPReturnsOnCall(i int, result1 *rtp.Packet, result2 error) { func (fake *FakeReceiver) GetBufferedPacketReturnsOnCall(i int, result1 rtp.Packet, result2 error) {
fake.readRTPMutex.Lock() fake.getBufferedPacketMutex.Lock()
defer fake.readRTPMutex.Unlock() defer fake.getBufferedPacketMutex.Unlock()
fake.ReadRTPStub = nil fake.GetBufferedPacketStub = nil
if fake.readRTPReturnsOnCall == nil { if fake.getBufferedPacketReturnsOnCall == nil {
fake.readRTPReturnsOnCall = make(map[int]struct { fake.getBufferedPacketReturnsOnCall = make(map[int]struct {
result1 *rtp.Packet result1 rtp.Packet
result2 error result2 error
}) })
} }
fake.readRTPReturnsOnCall[i] = struct { fake.getBufferedPacketReturnsOnCall[i] = struct {
result1 *rtp.Packet result1 rtp.Packet
result2 error result2 error
}{result1, result2} }{result1, result2}
} }
func (fake *FakeReceiver) Start() { func (fake *FakeReceiver) RTPChan() <-chan rtp.Packet {
fake.startMutex.Lock() fake.rTPChanMutex.Lock()
fake.startArgsForCall = append(fake.startArgsForCall, struct { ret, specificReturn := fake.rTPChanReturnsOnCall[len(fake.rTPChanArgsForCall)]
fake.rTPChanArgsForCall = append(fake.rTPChanArgsForCall, struct {
}{}) }{})
stub := fake.StartStub stub := fake.RTPChanStub
fake.recordInvocation("Start", []interface{}{}) fakeReturns := fake.rTPChanReturns
fake.startMutex.Unlock() fake.recordInvocation("RTPChan", []interface{}{})
if stub != nil { fake.rTPChanMutex.Unlock()
fake.StartStub()
}
}
func (fake *FakeReceiver) StartCallCount() int {
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
return len(fake.startArgsForCall)
}
func (fake *FakeReceiver) StartCalls(stub func()) {
fake.startMutex.Lock()
defer fake.startMutex.Unlock()
fake.StartStub = stub
}
func (fake *FakeReceiver) TrackId() string {
fake.trackIdMutex.Lock()
ret, specificReturn := fake.trackIdReturnsOnCall[len(fake.trackIdArgsForCall)]
fake.trackIdArgsForCall = append(fake.trackIdArgsForCall, struct {
}{})
stub := fake.TrackIdStub
fakeReturns := fake.trackIdReturns
fake.recordInvocation("TrackId", []interface{}{})
fake.trackIdMutex.Unlock()
if stub != nil { if stub != nil {
return stub() return stub()
} }
@@ -220,52 +127,48 @@ func (fake *FakeReceiver) TrackId() string {
return fakeReturns.result1 return fakeReturns.result1
} }
func (fake *FakeReceiver) TrackIdCallCount() int { func (fake *FakeReceiver) RTPChanCallCount() int {
fake.trackIdMutex.RLock() fake.rTPChanMutex.RLock()
defer fake.trackIdMutex.RUnlock() defer fake.rTPChanMutex.RUnlock()
return len(fake.trackIdArgsForCall) return len(fake.rTPChanArgsForCall)
} }
func (fake *FakeReceiver) TrackIdCalls(stub func() string) { func (fake *FakeReceiver) RTPChanCalls(stub func() <-chan rtp.Packet) {
fake.trackIdMutex.Lock() fake.rTPChanMutex.Lock()
defer fake.trackIdMutex.Unlock() defer fake.rTPChanMutex.Unlock()
fake.TrackIdStub = stub fake.RTPChanStub = stub
} }
func (fake *FakeReceiver) TrackIdReturns(result1 string) { func (fake *FakeReceiver) RTPChanReturns(result1 <-chan rtp.Packet) {
fake.trackIdMutex.Lock() fake.rTPChanMutex.Lock()
defer fake.trackIdMutex.Unlock() defer fake.rTPChanMutex.Unlock()
fake.TrackIdStub = nil fake.RTPChanStub = nil
fake.trackIdReturns = struct { fake.rTPChanReturns = struct {
result1 string result1 <-chan rtp.Packet
}{result1} }{result1}
} }
func (fake *FakeReceiver) TrackIdReturnsOnCall(i int, result1 string) { func (fake *FakeReceiver) RTPChanReturnsOnCall(i int, result1 <-chan rtp.Packet) {
fake.trackIdMutex.Lock() fake.rTPChanMutex.Lock()
defer fake.trackIdMutex.Unlock() defer fake.rTPChanMutex.Unlock()
fake.TrackIdStub = nil fake.RTPChanStub = nil
if fake.trackIdReturnsOnCall == nil { if fake.rTPChanReturnsOnCall == nil {
fake.trackIdReturnsOnCall = make(map[int]struct { fake.rTPChanReturnsOnCall = make(map[int]struct {
result1 string result1 <-chan rtp.Packet
}) })
} }
fake.trackIdReturnsOnCall[i] = struct { fake.rTPChanReturnsOnCall[i] = struct {
result1 string result1 <-chan rtp.Packet
}{result1} }{result1}
} }
func (fake *FakeReceiver) Invocations() map[string][][]interface{} { func (fake *FakeReceiver) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock() fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock() defer fake.invocationsMutex.RUnlock()
fake.getBufferedPacketsMutex.RLock() fake.getBufferedPacketMutex.RLock()
defer fake.getBufferedPacketsMutex.RUnlock() defer fake.getBufferedPacketMutex.RUnlock()
fake.readRTPMutex.RLock() fake.rTPChanMutex.RLock()
defer fake.readRTPMutex.RUnlock() defer fake.rTPChanMutex.RUnlock()
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
fake.trackIdMutex.RLock()
defer fake.trackIdMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{} copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations { for key, value := range fake.invocations {
copiedInvocations[key] = value copiedInvocations[key] = value
@@ -0,0 +1,298 @@
// Code generated by counterfeiter. DO NOT EDIT.
package typesfakes
import (
"sync"
"github.com/livekit/livekit-server/pkg/rtc/types"
webrtc "github.com/pion/webrtc/v3"
)
type FakeTrackRemote struct {
CodecStub func() webrtc.RTPCodecParameters
codecMutex sync.RWMutex
codecArgsForCall []struct {
}
codecReturns struct {
result1 webrtc.RTPCodecParameters
}
codecReturnsOnCall map[int]struct {
result1 webrtc.RTPCodecParameters
}
KindStub func() webrtc.RTPCodecType
kindMutex sync.RWMutex
kindArgsForCall []struct {
}
kindReturns struct {
result1 webrtc.RTPCodecType
}
kindReturnsOnCall map[int]struct {
result1 webrtc.RTPCodecType
}
SSRCStub func() webrtc.SSRC
sSRCMutex sync.RWMutex
sSRCArgsForCall []struct {
}
sSRCReturns struct {
result1 webrtc.SSRC
}
sSRCReturnsOnCall map[int]struct {
result1 webrtc.SSRC
}
StreamIDStub func() string
streamIDMutex sync.RWMutex
streamIDArgsForCall []struct {
}
streamIDReturns struct {
result1 string
}
streamIDReturnsOnCall map[int]struct {
result1 string
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeTrackRemote) Codec() webrtc.RTPCodecParameters {
fake.codecMutex.Lock()
ret, specificReturn := fake.codecReturnsOnCall[len(fake.codecArgsForCall)]
fake.codecArgsForCall = append(fake.codecArgsForCall, struct {
}{})
stub := fake.CodecStub
fakeReturns := fake.codecReturns
fake.recordInvocation("Codec", []interface{}{})
fake.codecMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeTrackRemote) CodecCallCount() int {
fake.codecMutex.RLock()
defer fake.codecMutex.RUnlock()
return len(fake.codecArgsForCall)
}
func (fake *FakeTrackRemote) CodecCalls(stub func() webrtc.RTPCodecParameters) {
fake.codecMutex.Lock()
defer fake.codecMutex.Unlock()
fake.CodecStub = stub
}
func (fake *FakeTrackRemote) CodecReturns(result1 webrtc.RTPCodecParameters) {
fake.codecMutex.Lock()
defer fake.codecMutex.Unlock()
fake.CodecStub = nil
fake.codecReturns = struct {
result1 webrtc.RTPCodecParameters
}{result1}
}
func (fake *FakeTrackRemote) CodecReturnsOnCall(i int, result1 webrtc.RTPCodecParameters) {
fake.codecMutex.Lock()
defer fake.codecMutex.Unlock()
fake.CodecStub = nil
if fake.codecReturnsOnCall == nil {
fake.codecReturnsOnCall = make(map[int]struct {
result1 webrtc.RTPCodecParameters
})
}
fake.codecReturnsOnCall[i] = struct {
result1 webrtc.RTPCodecParameters
}{result1}
}
func (fake *FakeTrackRemote) Kind() webrtc.RTPCodecType {
fake.kindMutex.Lock()
ret, specificReturn := fake.kindReturnsOnCall[len(fake.kindArgsForCall)]
fake.kindArgsForCall = append(fake.kindArgsForCall, struct {
}{})
stub := fake.KindStub
fakeReturns := fake.kindReturns
fake.recordInvocation("Kind", []interface{}{})
fake.kindMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeTrackRemote) KindCallCount() int {
fake.kindMutex.RLock()
defer fake.kindMutex.RUnlock()
return len(fake.kindArgsForCall)
}
func (fake *FakeTrackRemote) KindCalls(stub func() webrtc.RTPCodecType) {
fake.kindMutex.Lock()
defer fake.kindMutex.Unlock()
fake.KindStub = stub
}
func (fake *FakeTrackRemote) KindReturns(result1 webrtc.RTPCodecType) {
fake.kindMutex.Lock()
defer fake.kindMutex.Unlock()
fake.KindStub = nil
fake.kindReturns = struct {
result1 webrtc.RTPCodecType
}{result1}
}
func (fake *FakeTrackRemote) KindReturnsOnCall(i int, result1 webrtc.RTPCodecType) {
fake.kindMutex.Lock()
defer fake.kindMutex.Unlock()
fake.KindStub = nil
if fake.kindReturnsOnCall == nil {
fake.kindReturnsOnCall = make(map[int]struct {
result1 webrtc.RTPCodecType
})
}
fake.kindReturnsOnCall[i] = struct {
result1 webrtc.RTPCodecType
}{result1}
}
func (fake *FakeTrackRemote) SSRC() webrtc.SSRC {
fake.sSRCMutex.Lock()
ret, specificReturn := fake.sSRCReturnsOnCall[len(fake.sSRCArgsForCall)]
fake.sSRCArgsForCall = append(fake.sSRCArgsForCall, struct {
}{})
stub := fake.SSRCStub
fakeReturns := fake.sSRCReturns
fake.recordInvocation("SSRC", []interface{}{})
fake.sSRCMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeTrackRemote) SSRCCallCount() int {
fake.sSRCMutex.RLock()
defer fake.sSRCMutex.RUnlock()
return len(fake.sSRCArgsForCall)
}
func (fake *FakeTrackRemote) SSRCCalls(stub func() webrtc.SSRC) {
fake.sSRCMutex.Lock()
defer fake.sSRCMutex.Unlock()
fake.SSRCStub = stub
}
func (fake *FakeTrackRemote) SSRCReturns(result1 webrtc.SSRC) {
fake.sSRCMutex.Lock()
defer fake.sSRCMutex.Unlock()
fake.SSRCStub = nil
fake.sSRCReturns = struct {
result1 webrtc.SSRC
}{result1}
}
func (fake *FakeTrackRemote) SSRCReturnsOnCall(i int, result1 webrtc.SSRC) {
fake.sSRCMutex.Lock()
defer fake.sSRCMutex.Unlock()
fake.SSRCStub = nil
if fake.sSRCReturnsOnCall == nil {
fake.sSRCReturnsOnCall = make(map[int]struct {
result1 webrtc.SSRC
})
}
fake.sSRCReturnsOnCall[i] = struct {
result1 webrtc.SSRC
}{result1}
}
func (fake *FakeTrackRemote) StreamID() string {
fake.streamIDMutex.Lock()
ret, specificReturn := fake.streamIDReturnsOnCall[len(fake.streamIDArgsForCall)]
fake.streamIDArgsForCall = append(fake.streamIDArgsForCall, struct {
}{})
stub := fake.StreamIDStub
fakeReturns := fake.streamIDReturns
fake.recordInvocation("StreamID", []interface{}{})
fake.streamIDMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeTrackRemote) StreamIDCallCount() int {
fake.streamIDMutex.RLock()
defer fake.streamIDMutex.RUnlock()
return len(fake.streamIDArgsForCall)
}
func (fake *FakeTrackRemote) StreamIDCalls(stub func() string) {
fake.streamIDMutex.Lock()
defer fake.streamIDMutex.Unlock()
fake.StreamIDStub = stub
}
func (fake *FakeTrackRemote) StreamIDReturns(result1 string) {
fake.streamIDMutex.Lock()
defer fake.streamIDMutex.Unlock()
fake.StreamIDStub = nil
fake.streamIDReturns = struct {
result1 string
}{result1}
}
func (fake *FakeTrackRemote) StreamIDReturnsOnCall(i int, result1 string) {
fake.streamIDMutex.Lock()
defer fake.streamIDMutex.Unlock()
fake.StreamIDStub = nil
if fake.streamIDReturnsOnCall == nil {
fake.streamIDReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.streamIDReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *FakeTrackRemote) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.codecMutex.RLock()
defer fake.codecMutex.RUnlock()
fake.kindMutex.RLock()
defer fake.kindMutex.RUnlock()
fake.sSRCMutex.RLock()
defer fake.sSRCMutex.RUnlock()
fake.streamIDMutex.RLock()
defer fake.streamIDMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeTrackRemote) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ types.TrackRemote = new(FakeTrackRemote)
+7 -7
View File
@@ -75,14 +75,14 @@ func FromProtoSessionDescription(sd *livekit.SessionDescription) webrtc.SessionD
} }
} }
func ToProtoTrickle(candidateInit webrtc.ICECandidateInit) *livekit.Trickle { func ToProtoTrickle(candidateInit webrtc.ICECandidateInit) *livekit.TrickleRequest {
data, _ := json.Marshal(candidateInit) data, _ := json.Marshal(candidateInit)
return &livekit.Trickle{ return &livekit.TrickleRequest{
CandidateInit: string(data), CandidateInit: string(data),
} }
} }
func FromProtoTrickle(trickle *livekit.Trickle) webrtc.ICECandidateInit { func FromProtoTrickle(trickle *livekit.TrickleRequest) webrtc.ICECandidateInit {
ci := webrtc.ICECandidateInit{} ci := webrtc.ICECandidateInit{}
json.Unmarshal([]byte(trickle.CandidateInit), &ci) json.Unmarshal([]byte(trickle.CandidateInit), &ci)
return ci return ci
@@ -92,17 +92,17 @@ func ToProtoTrack(t types.PublishedTrack) *livekit.TrackInfo {
return &livekit.TrackInfo{ return &livekit.TrackInfo{
Sid: t.ID(), Sid: t.ID(),
Type: t.Kind(), Type: t.Kind(),
Name: t.StreamID(), Name: t.Name(),
Muted: t.IsMuted(), Muted: t.IsMuted(),
} }
} }
func ToProtoTrackKind(kind webrtc.RTPCodecType) livekit.TrackInfo_Type { func ToProtoTrackKind(kind webrtc.RTPCodecType) livekit.TrackType {
switch kind { switch kind {
case webrtc.RTPCodecTypeVideo: case webrtc.RTPCodecTypeVideo:
return livekit.TrackInfo_VIDEO return livekit.TrackType_VIDEO
case webrtc.RTPCodecTypeAudio: case webrtc.RTPCodecTypeAudio:
return livekit.TrackInfo_AUDIO return livekit.TrackType_AUDIO
} }
panic("unsupported track kind") panic("unsupported track kind")
} }
+12 -7
View File
@@ -131,16 +131,20 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
log.Errorw("could not handle join", "err", err, "participant", participant.ID()) log.Errorw("could not handle join", "err", err, "participant", participant.ID())
return return
} }
case *livekit.SignalRequest_Negotiate: case *livekit.SignalRequest_AddTrack:
log.Debugw("publishing track", "participant", participant.ID(),
"track", msg.AddTrack.Cid)
participant.AddTrack(msg.AddTrack.Cid, msg.AddTrack.Name, msg.AddTrack.Type)
case *livekit.SignalRequest_Answer:
if participant.State() == livekit.ParticipantInfo_JOINING { if participant.State() == livekit.ParticipantInfo_JOINING {
log.Errorw("cannot negotiate before peer offer", "participant", participant.ID()) log.Errorw("cannot negotiate before peer offer", "participant", participant.ID())
//conn.WriteJSON(jsonError(http.StatusNotAcceptable, "cannot negotiate before peer offer")) //conn.WriteJSON(jsonError(http.StatusNotAcceptable, "cannot negotiate before peer offer"))
return return
} }
sd := rtc.FromProtoSessionDescription(msg.Negotiate) sd := rtc.FromProtoSessionDescription(msg.Answer)
err = participant.HandleNegotiate(sd) err = participant.HandleAnswer(sd)
if err != nil { if err != nil {
log.Errorw("could not handle negotiate", "participant", participant.ID(), "err", err) log.Errorw("could not handle answer", "participant", participant.ID(), "err", err)
//conn.WriteJSON( //conn.WriteJSON(
// jsonError(http.StatusInternalServerError, "could not handle negotiate", err.Error())) // jsonError(http.StatusInternalServerError, "could not handle negotiate", err.Error()))
return return
@@ -160,9 +164,10 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
} }
case *livekit.SignalRequest_Mute: case *livekit.SignalRequest_Mute:
participant.SetTrackMuted(msg.Mute.TrackSid, msg.Mute.Muted) participant.SetTrackMuted(msg.Mute.Sid, msg.Mute.Muted)
case *livekit.SignalRequest_RemoveTrack:
participant.RemoveTrack(msg.RemoveTrack.Sid)
} }
} }
} }
@@ -178,7 +183,7 @@ func (s *RTCService) handleOffer(participant types.Participant, offer *livekit.S
return nil return nil
} }
func (s *RTCService) handleTrickle(participant types.Participant, trickle *livekit.Trickle) error { func (s *RTCService) handleTrickle(participant types.Participant, trickle *livekit.TrickleRequest) error {
candidateInit := rtc.FromProtoTrickle(trickle) candidateInit := rtc.FromProtoTrickle(trickle)
logger.GetLogger().Debugw("adding peer candidate", "participant", participant.ID()) logger.GetLogger().Debugw("adding peer candidate", "participant", participant.ID())
if err := participant.AddICECandidate(candidateInit); err != nil { if err := participant.AddICECandidate(candidateInit); err != nil {
+2 -2
View File
@@ -113,11 +113,11 @@ func (d *DownTrack) Kind() webrtc.RTPCodecType {
} }
// WriteRTP writes a RTP Packet to the DownTrack // WriteRTP writes a RTP Packet to the DownTrack
func (d *DownTrack) WriteRTP(p *rtp.Packet) error { func (d *DownTrack) WriteRTP(p rtp.Packet) error {
if !d.IsBound() { if !d.IsBound() {
return nil return nil
} }
return d.writeSimpleRTP(*p) return d.writeSimpleRTP(p)
} }
func (d *DownTrack) CreateSourceDescriptionChunks() []rtcp.SourceDescriptionChunk { func (d *DownTrack) CreateSourceDescriptionChunks() []rtcp.SourceDescriptionChunk {
+80 -80
View File
@@ -25,6 +25,55 @@ const (
// of the legacy proto package is being used. // of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4 const _ = proto.ProtoPackageIsVersion4
type TrackType int32
const (
TrackType_AUDIO TrackType = 0
TrackType_VIDEO TrackType = 1
TrackType_DATA TrackType = 2
)
// Enum value maps for TrackType.
var (
TrackType_name = map[int32]string{
0: "AUDIO",
1: "VIDEO",
2: "DATA",
}
TrackType_value = map[string]int32{
"AUDIO": 0,
"VIDEO": 1,
"DATA": 2,
}
)
func (x TrackType) Enum() *TrackType {
p := new(TrackType)
*p = x
return p
}
func (x TrackType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TrackType) Descriptor() protoreflect.EnumDescriptor {
return file_model_proto_enumTypes[0].Descriptor()
}
func (TrackType) Type() protoreflect.EnumType {
return &file_model_proto_enumTypes[0]
}
func (x TrackType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use TrackType.Descriptor instead.
func (TrackType) EnumDescriptor() ([]byte, []int) {
return file_model_proto_rawDescGZIP(), []int{0}
}
type ParticipantInfo_State int32 type ParticipantInfo_State int32
const ( const (
@@ -65,11 +114,11 @@ func (x ParticipantInfo_State) String() string {
} }
func (ParticipantInfo_State) Descriptor() protoreflect.EnumDescriptor { func (ParticipantInfo_State) Descriptor() protoreflect.EnumDescriptor {
return file_model_proto_enumTypes[0].Descriptor() return file_model_proto_enumTypes[1].Descriptor()
} }
func (ParticipantInfo_State) Type() protoreflect.EnumType { func (ParticipantInfo_State) Type() protoreflect.EnumType {
return &file_model_proto_enumTypes[0] return &file_model_proto_enumTypes[1]
} }
func (x ParticipantInfo_State) Number() protoreflect.EnumNumber { func (x ParticipantInfo_State) Number() protoreflect.EnumNumber {
@@ -81,55 +130,6 @@ func (ParticipantInfo_State) EnumDescriptor() ([]byte, []int) {
return file_model_proto_rawDescGZIP(), []int{4, 0} return file_model_proto_rawDescGZIP(), []int{4, 0}
} }
type TrackInfo_Type int32
const (
TrackInfo_AUDIO TrackInfo_Type = 0
TrackInfo_VIDEO TrackInfo_Type = 1
TrackInfo_DATA TrackInfo_Type = 2
)
// Enum value maps for TrackInfo_Type.
var (
TrackInfo_Type_name = map[int32]string{
0: "AUDIO",
1: "VIDEO",
2: "DATA",
}
TrackInfo_Type_value = map[string]int32{
"AUDIO": 0,
"VIDEO": 1,
"DATA": 2,
}
)
func (x TrackInfo_Type) Enum() *TrackInfo_Type {
p := new(TrackInfo_Type)
*p = x
return p
}
func (x TrackInfo_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TrackInfo_Type) Descriptor() protoreflect.EnumDescriptor {
return file_model_proto_enumTypes[1].Descriptor()
}
func (TrackInfo_Type) Type() protoreflect.EnumType {
return &file_model_proto_enumTypes[1]
}
func (x TrackInfo_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use TrackInfo_Type.Descriptor instead.
func (TrackInfo_Type) EnumDescriptor() ([]byte, []int) {
return file_model_proto_rawDescGZIP(), []int{5, 0}
}
type Node struct { type Node struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -484,10 +484,10 @@ type TrackInfo struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"` Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
Type TrackInfo_Type `protobuf:"varint,2,opt,name=type,proto3,enum=livekit.TrackInfo_Type" json:"type,omitempty"` Type TrackType `protobuf:"varint,2,opt,name=type,proto3,enum=livekit.TrackType" json:"type,omitempty"`
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Muted bool `protobuf:"varint,4,opt,name=muted,proto3" json:"muted,omitempty"` Muted bool `protobuf:"varint,4,opt,name=muted,proto3" json:"muted,omitempty"`
} }
func (x *TrackInfo) Reset() { func (x *TrackInfo) Reset() {
@@ -529,11 +529,11 @@ func (x *TrackInfo) GetSid() string {
return "" return ""
} }
func (x *TrackInfo) GetType() TrackInfo_Type { func (x *TrackInfo) GetType() TrackType {
if x != nil { if x != nil {
return x.Type return x.Type
} }
return TrackInfo_AUDIO return TrackType_AUDIO
} }
func (x *TrackInfo) GetName() string { func (x *TrackInfo) GetName() string {
@@ -676,25 +676,25 @@ var file_model_proto_rawDesc = []byte{
0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4a, 0x4f, 0x49, 0x4e, 0x49, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x4a, 0x4f, 0x49, 0x4e, 0x49,
0x4e, 0x47, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4a, 0x4f, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x01, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4a, 0x4f, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x01,
0x12, 0x0a, 0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c, 0x12, 0x0a, 0x0a, 0x06, 0x41, 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x02, 0x12, 0x10, 0x0a, 0x0c,
0x44, 0x49, 0x53, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x9c, 0x44, 0x49, 0x53, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x45, 0x44, 0x10, 0x03, 0x22, 0x6f,
0x01, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x73,
0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x2b, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x26, 0x0a,
0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x6c, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x6c, 0x69,
0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x52,
0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x75, 0x74,
0x14, 0x0a, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x22,
0x6d, 0x75, 0x74, 0x65, 0x64, 0x22, 0x26, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x46, 0x0a, 0x0b, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14,
0x05, 0x41, 0x55, 0x44, 0x49, 0x4f, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x56, 0x49, 0x44, 0x45, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04,
0x4f, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41, 0x54, 0x41, 0x10, 0x02, 0x22, 0x46, 0x0a, 0x74, 0x65, 0x78, 0x74, 0x12, 0x18, 0x0a, 0x06, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x02,
0x0b, 0x44, 0x61, 0x74, 0x61, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x06, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x42, 0x07,
0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x74, 0x65, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x2b, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x63, 0x6b,
0x78, 0x74, 0x12, 0x18, 0x0a, 0x06, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x55, 0x44, 0x49, 0x4f, 0x10, 0x00, 0x12,
0x28, 0x0c, 0x48, 0x00, 0x52, 0x06, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x42, 0x07, 0x0a, 0x05, 0x09, 0x0a, 0x05, 0x56, 0x49, 0x44, 0x45, 0x4f, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x41,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x54, 0x41, 0x10, 0x02, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b,
0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -712,8 +712,8 @@ func file_model_proto_rawDescGZIP() []byte {
var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_model_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_model_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_model_proto_goTypes = []interface{}{ var file_model_proto_goTypes = []interface{}{
(ParticipantInfo_State)(0), // 0: livekit.ParticipantInfo.State (TrackType)(0), // 0: livekit.TrackType
(TrackInfo_Type)(0), // 1: livekit.TrackInfo.Type (ParticipantInfo_State)(0), // 1: livekit.ParticipantInfo.State
(*Node)(nil), // 2: livekit.Node (*Node)(nil), // 2: livekit.Node
(*NodeStats)(nil), // 3: livekit.NodeStats (*NodeStats)(nil), // 3: livekit.NodeStats
(*Room)(nil), // 4: livekit.Room (*Room)(nil), // 4: livekit.Room
@@ -724,9 +724,9 @@ var file_model_proto_goTypes = []interface{}{
} }
var file_model_proto_depIdxs = []int32{ var file_model_proto_depIdxs = []int32{
3, // 0: livekit.Node.stats:type_name -> livekit.NodeStats 3, // 0: livekit.Node.stats:type_name -> livekit.NodeStats
0, // 1: livekit.ParticipantInfo.state:type_name -> livekit.ParticipantInfo.State 1, // 1: livekit.ParticipantInfo.state:type_name -> livekit.ParticipantInfo.State
7, // 2: livekit.ParticipantInfo.tracks:type_name -> livekit.TrackInfo 7, // 2: livekit.ParticipantInfo.tracks:type_name -> livekit.TrackInfo
1, // 3: livekit.TrackInfo.type:type_name -> livekit.TrackInfo.Type 0, // 3: livekit.TrackInfo.type:type_name -> livekit.TrackType
4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type 4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name 4, // [4:4] is the sub-list for extension type_name
+343 -154
View File
@@ -32,9 +32,11 @@ type SignalRequest struct {
// Types that are assignable to Message: // Types that are assignable to Message:
// *SignalRequest_Offer // *SignalRequest_Offer
// *SignalRequest_Negotiate // *SignalRequest_Answer
// *SignalRequest_Trickle // *SignalRequest_Trickle
// *SignalRequest_AddTrack
// *SignalRequest_Mute // *SignalRequest_Mute
// *SignalRequest_RemoveTrack
Message isSignalRequest_Message `protobuf_oneof:"message"` Message isSignalRequest_Message `protobuf_oneof:"message"`
} }
@@ -84,55 +86,83 @@ func (x *SignalRequest) GetOffer() *SessionDescription {
return nil return nil
} }
func (x *SignalRequest) GetNegotiate() *SessionDescription { func (x *SignalRequest) GetAnswer() *SessionDescription {
if x, ok := x.GetMessage().(*SignalRequest_Negotiate); ok { if x, ok := x.GetMessage().(*SignalRequest_Answer); ok {
return x.Negotiate return x.Answer
} }
return nil return nil
} }
func (x *SignalRequest) GetTrickle() *Trickle { func (x *SignalRequest) GetTrickle() *TrickleRequest {
if x, ok := x.GetMessage().(*SignalRequest_Trickle); ok { if x, ok := x.GetMessage().(*SignalRequest_Trickle); ok {
return x.Trickle return x.Trickle
} }
return nil return nil
} }
func (x *SignalRequest) GetMute() *MuteTrack { func (x *SignalRequest) GetAddTrack() *AddTrackRequest {
if x, ok := x.GetMessage().(*SignalRequest_AddTrack); ok {
return x.AddTrack
}
return nil
}
func (x *SignalRequest) GetMute() *MuteTrackRequest {
if x, ok := x.GetMessage().(*SignalRequest_Mute); ok { if x, ok := x.GetMessage().(*SignalRequest_Mute); ok {
return x.Mute return x.Mute
} }
return nil return nil
} }
func (x *SignalRequest) GetRemoveTrack() *RemoveTrackRequest {
if x, ok := x.GetMessage().(*SignalRequest_RemoveTrack); ok {
return x.RemoveTrack
}
return nil
}
type isSignalRequest_Message interface { type isSignalRequest_Message interface {
isSignalRequest_Message() isSignalRequest_Message()
} }
type SignalRequest_Offer struct { type SignalRequest_Offer struct {
// participant joining initially
Offer *SessionDescription `protobuf:"bytes,1,opt,name=offer,proto3,oneof"` Offer *SessionDescription `protobuf:"bytes,1,opt,name=offer,proto3,oneof"`
} }
type SignalRequest_Negotiate struct { type SignalRequest_Answer struct {
Negotiate *SessionDescription `protobuf:"bytes,2,opt,name=negotiate,proto3,oneof"` // participant responding to server-issued offers
Answer *SessionDescription `protobuf:"bytes,2,opt,name=answer,proto3,oneof"`
} }
type SignalRequest_Trickle struct { type SignalRequest_Trickle struct {
Trickle *Trickle `protobuf:"bytes,3,opt,name=trickle,proto3,oneof"` Trickle *TrickleRequest `protobuf:"bytes,3,opt,name=trickle,proto3,oneof"`
}
type SignalRequest_AddTrack struct {
AddTrack *AddTrackRequest `protobuf:"bytes,4,opt,name=add_track,json=addTrack,proto3,oneof"`
} }
type SignalRequest_Mute struct { type SignalRequest_Mute struct {
Mute *MuteTrack `protobuf:"bytes,4,opt,name=mute,proto3,oneof"` Mute *MuteTrackRequest `protobuf:"bytes,5,opt,name=mute,proto3,oneof"`
}
type SignalRequest_RemoveTrack struct {
RemoveTrack *RemoveTrackRequest `protobuf:"bytes,6,opt,name=remove_track,json=removeTrack,proto3,oneof"`
} }
func (*SignalRequest_Offer) isSignalRequest_Message() {} func (*SignalRequest_Offer) isSignalRequest_Message() {}
func (*SignalRequest_Negotiate) isSignalRequest_Message() {} func (*SignalRequest_Answer) isSignalRequest_Message() {}
func (*SignalRequest_Trickle) isSignalRequest_Message() {} func (*SignalRequest_Trickle) isSignalRequest_Message() {}
func (*SignalRequest_AddTrack) isSignalRequest_Message() {}
func (*SignalRequest_Mute) isSignalRequest_Message() {} func (*SignalRequest_Mute) isSignalRequest_Message() {}
func (*SignalRequest_RemoveTrack) isSignalRequest_Message() {}
type SignalResponse struct { type SignalResponse struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -141,7 +171,7 @@ type SignalResponse struct {
// Types that are assignable to Message: // Types that are assignable to Message:
// *SignalResponse_Join // *SignalResponse_Join
// *SignalResponse_Answer // *SignalResponse_Answer
// *SignalResponse_Negotiate // *SignalResponse_Offer
// *SignalResponse_Trickle // *SignalResponse_Trickle
// *SignalResponse_Update // *SignalResponse_Update
// *SignalResponse_TrackPublished // *SignalResponse_TrackPublished
@@ -201,14 +231,14 @@ func (x *SignalResponse) GetAnswer() *SessionDescription {
return nil return nil
} }
func (x *SignalResponse) GetNegotiate() *SessionDescription { func (x *SignalResponse) GetOffer() *SessionDescription {
if x, ok := x.GetMessage().(*SignalResponse_Negotiate); ok { if x, ok := x.GetMessage().(*SignalResponse_Offer); ok {
return x.Negotiate return x.Offer
} }
return nil return nil
} }
func (x *SignalResponse) GetTrickle() *Trickle { func (x *SignalResponse) GetTrickle() *TrickleRequest {
if x, ok := x.GetMessage().(*SignalResponse_Trickle); ok { if x, ok := x.GetMessage().(*SignalResponse_Trickle); ok {
return x.Trickle return x.Trickle
} }
@@ -243,14 +273,14 @@ type SignalResponse_Answer struct {
Answer *SessionDescription `protobuf:"bytes,2,opt,name=answer,proto3,oneof"` Answer *SessionDescription `protobuf:"bytes,2,opt,name=answer,proto3,oneof"`
} }
type SignalResponse_Negotiate struct { type SignalResponse_Offer struct {
// sent when a negotiated sd is available (could be either offer or answer) // sent when server needs to negotiate, always offer
Negotiate *SessionDescription `protobuf:"bytes,3,opt,name=negotiate,proto3,oneof"` Offer *SessionDescription `protobuf:"bytes,3,opt,name=offer,proto3,oneof"`
} }
type SignalResponse_Trickle struct { type SignalResponse_Trickle struct {
// sent when an ICE candidate is available // sent when an ICE candidate is available
Trickle *Trickle `protobuf:"bytes,4,opt,name=trickle,proto3,oneof"` Trickle *TrickleRequest `protobuf:"bytes,4,opt,name=trickle,proto3,oneof"`
} }
type SignalResponse_Update struct { type SignalResponse_Update struct {
@@ -260,14 +290,14 @@ type SignalResponse_Update struct {
type SignalResponse_TrackPublished struct { type SignalResponse_TrackPublished struct {
// sent to the participant when their track has been published // sent to the participant when their track has been published
TrackPublished *TrackInfo `protobuf:"bytes,6,opt,name=trackPublished,proto3,oneof"` TrackPublished *TrackInfo `protobuf:"bytes,6,opt,name=track_published,json=trackPublished,proto3,oneof"`
} }
func (*SignalResponse_Join) isSignalResponse_Message() {} func (*SignalResponse_Join) isSignalResponse_Message() {}
func (*SignalResponse_Answer) isSignalResponse_Message() {} func (*SignalResponse_Answer) isSignalResponse_Message() {}
func (*SignalResponse_Negotiate) isSignalResponse_Message() {} func (*SignalResponse_Offer) isSignalResponse_Message() {}
func (*SignalResponse_Trickle) isSignalResponse_Message() {} func (*SignalResponse_Trickle) isSignalResponse_Message() {}
@@ -275,16 +305,19 @@ func (*SignalResponse_Update) isSignalResponse_Message() {}
func (*SignalResponse_TrackPublished) isSignalResponse_Message() {} func (*SignalResponse_TrackPublished) isSignalResponse_Message() {}
type Trickle struct { type AddTrackRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
CandidateInit string `protobuf:"bytes,1,opt,name=candidateInit,proto3" json:"candidateInit,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Type TrackType `protobuf:"varint,2,opt,name=type,proto3,enum=livekit.TrackType" json:"type,omitempty"`
// client ID of track, to match it when RTC track is received
Cid string `protobuf:"bytes,3,opt,name=cid,proto3" json:"cid,omitempty"`
} }
func (x *Trickle) Reset() { func (x *AddTrackRequest) Reset() {
*x = Trickle{} *x = AddTrackRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[2] mi := &file_rtc_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -292,13 +325,13 @@ func (x *Trickle) Reset() {
} }
} }
func (x *Trickle) String() string { func (x *AddTrackRequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*Trickle) ProtoMessage() {} func (*AddTrackRequest) ProtoMessage() {}
func (x *Trickle) ProtoReflect() protoreflect.Message { func (x *AddTrackRequest) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[2] mi := &file_rtc_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -310,18 +343,126 @@ func (x *Trickle) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use Trickle.ProtoReflect.Descriptor instead. // Deprecated: Use AddTrackRequest.ProtoReflect.Descriptor instead.
func (*Trickle) Descriptor() ([]byte, []int) { func (*AddTrackRequest) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{2} return file_rtc_proto_rawDescGZIP(), []int{2}
} }
func (x *Trickle) GetCandidateInit() string { func (x *AddTrackRequest) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *AddTrackRequest) GetType() TrackType {
if x != nil {
return x.Type
}
return TrackType_AUDIO
}
func (x *AddTrackRequest) GetCid() string {
if x != nil {
return x.Cid
}
return ""
}
type TrickleRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CandidateInit string `protobuf:"bytes,1,opt,name=candidateInit,proto3" json:"candidateInit,omitempty"`
}
func (x *TrickleRequest) Reset() {
*x = TrickleRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TrickleRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrickleRequest) ProtoMessage() {}
func (x *TrickleRequest) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrickleRequest.ProtoReflect.Descriptor instead.
func (*TrickleRequest) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{3}
}
func (x *TrickleRequest) GetCandidateInit() string {
if x != nil { if x != nil {
return x.CandidateInit return x.CandidateInit
} }
return "" return ""
} }
type RemoveTrackRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
}
func (x *RemoveTrackRequest) Reset() {
*x = RemoveTrackRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RemoveTrackRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RemoveTrackRequest) ProtoMessage() {}
func (x *RemoveTrackRequest) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RemoveTrackRequest.ProtoReflect.Descriptor instead.
func (*RemoveTrackRequest) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{4}
}
func (x *RemoveTrackRequest) GetSid() string {
if x != nil {
return x.Sid
}
return ""
}
type SessionDescription struct { type SessionDescription struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -334,7 +475,7 @@ type SessionDescription struct {
func (x *SessionDescription) Reset() { func (x *SessionDescription) Reset() {
*x = SessionDescription{} *x = SessionDescription{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[3] mi := &file_rtc_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -347,7 +488,7 @@ func (x *SessionDescription) String() string {
func (*SessionDescription) ProtoMessage() {} func (*SessionDescription) ProtoMessage() {}
func (x *SessionDescription) ProtoReflect() protoreflect.Message { func (x *SessionDescription) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[3] mi := &file_rtc_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -360,7 +501,7 @@ func (x *SessionDescription) ProtoReflect() protoreflect.Message {
// Deprecated: Use SessionDescription.ProtoReflect.Descriptor instead. // Deprecated: Use SessionDescription.ProtoReflect.Descriptor instead.
func (*SessionDescription) Descriptor() ([]byte, []int) { func (*SessionDescription) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{3} return file_rtc_proto_rawDescGZIP(), []int{5}
} }
func (x *SessionDescription) GetType() string { func (x *SessionDescription) GetType() string {
@@ -390,7 +531,7 @@ type JoinResponse struct {
func (x *JoinResponse) Reset() { func (x *JoinResponse) Reset() {
*x = JoinResponse{} *x = JoinResponse{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[4] mi := &file_rtc_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -403,7 +544,7 @@ func (x *JoinResponse) String() string {
func (*JoinResponse) ProtoMessage() {} func (*JoinResponse) ProtoMessage() {}
func (x *JoinResponse) ProtoReflect() protoreflect.Message { func (x *JoinResponse) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[4] mi := &file_rtc_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -416,7 +557,7 @@ func (x *JoinResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use JoinResponse.ProtoReflect.Descriptor instead. // Deprecated: Use JoinResponse.ProtoReflect.Descriptor instead.
func (*JoinResponse) Descriptor() ([]byte, []int) { func (*JoinResponse) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{4} return file_rtc_proto_rawDescGZIP(), []int{6}
} }
func (x *JoinResponse) GetRoom() *RoomInfo { func (x *JoinResponse) GetRoom() *RoomInfo {
@@ -440,32 +581,32 @@ func (x *JoinResponse) GetOtherParticipants() []*ParticipantInfo {
return nil return nil
} }
type MuteTrack struct { type MuteTrackRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
TrackSid string `protobuf:"bytes,1,opt,name=track_sid,json=trackSid,proto3" json:"track_sid,omitempty"` Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
Muted bool `protobuf:"varint,2,opt,name=muted,proto3" json:"muted,omitempty"` Muted bool `protobuf:"varint,2,opt,name=muted,proto3" json:"muted,omitempty"`
} }
func (x *MuteTrack) Reset() { func (x *MuteTrackRequest) Reset() {
*x = MuteTrack{} *x = MuteTrackRequest{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[5] mi := &file_rtc_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
} }
func (x *MuteTrack) String() string { func (x *MuteTrackRequest) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*MuteTrack) ProtoMessage() {} func (*MuteTrackRequest) ProtoMessage() {}
func (x *MuteTrack) ProtoReflect() protoreflect.Message { func (x *MuteTrackRequest) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[5] mi := &file_rtc_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -476,19 +617,19 @@ func (x *MuteTrack) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use MuteTrack.ProtoReflect.Descriptor instead. // Deprecated: Use MuteTrackRequest.ProtoReflect.Descriptor instead.
func (*MuteTrack) Descriptor() ([]byte, []int) { func (*MuteTrackRequest) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{5} return file_rtc_proto_rawDescGZIP(), []int{7}
} }
func (x *MuteTrack) GetTrackSid() string { func (x *MuteTrackRequest) GetSid() string {
if x != nil { if x != nil {
return x.TrackSid return x.Sid
} }
return "" return ""
} }
func (x *MuteTrack) GetMuted() bool { func (x *MuteTrackRequest) GetMuted() bool {
if x != nil { if x != nil {
return x.Muted return x.Muted
} }
@@ -506,7 +647,7 @@ type ParticipantUpdate struct {
func (x *ParticipantUpdate) Reset() { func (x *ParticipantUpdate) Reset() {
*x = ParticipantUpdate{} *x = ParticipantUpdate{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_rtc_proto_msgTypes[6] mi := &file_rtc_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@@ -519,7 +660,7 @@ func (x *ParticipantUpdate) String() string {
func (*ParticipantUpdate) ProtoMessage() {} func (*ParticipantUpdate) ProtoMessage() {}
func (x *ParticipantUpdate) ProtoReflect() protoreflect.Message { func (x *ParticipantUpdate) ProtoReflect() protoreflect.Message {
mi := &file_rtc_proto_msgTypes[6] mi := &file_rtc_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@@ -532,7 +673,7 @@ func (x *ParticipantUpdate) ProtoReflect() protoreflect.Message {
// Deprecated: Use ParticipantUpdate.ProtoReflect.Descriptor instead. // Deprecated: Use ParticipantUpdate.ProtoReflect.Descriptor instead.
func (*ParticipantUpdate) Descriptor() ([]byte, []int) { func (*ParticipantUpdate) Descriptor() ([]byte, []int) {
return file_rtc_proto_rawDescGZIP(), []int{6} return file_rtc_proto_rawDescGZIP(), []int{8}
} }
func (x *ParticipantUpdate) GetParticipants() []*ParticipantInfo { func (x *ParticipantUpdate) GetParticipants() []*ParticipantInfo {
@@ -547,75 +688,91 @@ var File_rtc_proto protoreflect.FileDescriptor
var file_rtc_proto_rawDesc = []byte{ var file_rtc_proto_rawDesc = []byte{
0x0a, 0x09, 0x72, 0x74, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, 0x69, 0x76, 0x0a, 0x09, 0x72, 0x74, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, 0x69, 0x76,
0x65, 0x6b, 0x69, 0x74, 0x1a, 0x0b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x6b, 0x69, 0x74, 0x1a, 0x0b, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0xe4, 0x01, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x6f, 0x22, 0xe7, 0x02, 0x0a, 0x0d, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x65, 0x73, 0x74, 0x12, 0x33, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48,
0x00, 0x52, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x09, 0x6e, 0x65, 0x67, 0x6f, 0x00, 0x52, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77,
0x74, 0x69, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69,
0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73,
0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x65, 0x67, 0x6f,
0x74, 0x69, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74,
0x2e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x07, 0x74, 0x72, 0x69, 0x63,
0x6b, 0x6c, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x6d, 0x75, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65,
0x54, 0x72, 0x61, 0x63, 0x6b, 0x48, 0x00, 0x52, 0x04, 0x6d, 0x75, 0x74, 0x65, 0x42, 0x09, 0x0a,
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xde, 0x02, 0x0a, 0x0e, 0x53, 0x69, 0x67,
0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x6a,
0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65,
0x6b, 0x69, 0x74, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x48, 0x00, 0x52, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x12, 0x35, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77,
0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b,
0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12,
0x3b, 0x0a, 0x09, 0x6e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x69, 0x63, 0x6b,
0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x07, 0x74, 0x72, 0x69,
0x00, 0x52, 0x09, 0x6e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x07, 0x63, 0x6b, 0x6c, 0x65, 0x12, 0x37, 0x0a, 0x09, 0x61, 0x64, 0x64, 0x5f, 0x74, 0x72, 0x61, 0x63,
0x74, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69,
0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x48, 0x74, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x00, 0x52, 0x07, 0x74, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x75, 0x70, 0x74, 0x48, 0x00, 0x52, 0x08, 0x61, 0x64, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x2f, 0x0a,
0x64, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c, 0x69, 0x76, 0x04, 0x6d, 0x75, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x6c, 0x69,
0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x06, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x04, 0x6d, 0x75, 0x74, 0x65, 0x12, 0x40,
0x12, 0x3c, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x0a, 0x0c, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x18, 0x06,
0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x52,
0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x48, 0x00, 0x52, 0x0e, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x42, 0x09, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b,
0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2f, 0x0a, 0x07, 0x54, 0x72, 0x69, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xde, 0x02, 0x0a, 0x0e,
0x63, 0x6b, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b,
0x65, 0x49, 0x6e, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x61, 0x6e, 0x0a, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c,
0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x69, 0x74, 0x22, 0x3a, 0x0a, 0x12, 0x53, 0x65, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x04, 0x6a, 0x6f, 0x69, 0x6e, 0x12, 0x35, 0x0a, 0x06, 0x61,
0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69,
0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x64, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73,
0x09, 0x52, 0x03, 0x73, 0x64, 0x70, 0x22, 0xba, 0x01, 0x0a, 0x0c, 0x4a, 0x6f, 0x69, 0x6e, 0x52, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x18, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x73, 0x73,
0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x72, 0x6f, 0x6f, 0x6d, 0x12, 0x3a, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00,
0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x52, 0x05, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x72, 0x69, 0x63, 0x6b,
0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b,
0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x70, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x12, 0x6f, 0x74, 0x74, 0x48, 0x00, 0x52, 0x07, 0x74, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x12, 0x34, 0x0a, 0x06,
0x68, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6c,
0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61,
0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x06, 0x75, 0x70, 0x64, 0x61,
0x74, 0x65, 0x12, 0x3d, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x70, 0x75, 0x62, 0x6c,
0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x69,
0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x48,
0x00, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x65,
0x64, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x5f, 0x0a, 0x0f,
0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0e, 0x32, 0x12, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x63,
0x6b, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x63,
0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x22, 0x36, 0x0a,
0x0e, 0x54, 0x72, 0x69, 0x63, 0x6b, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
0x24, 0x0a, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x69, 0x74,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74,
0x65, 0x49, 0x6e, 0x69, 0x74, 0x22, 0x26, 0x0a, 0x12, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x54,
0x72, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x22, 0x3a, 0x0a,
0x12, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x64, 0x70, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x64, 0x70, 0x22, 0xba, 0x01, 0x0a, 0x0c, 0x4a, 0x6f,
0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x72, 0x6f,
0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b,
0x69, 0x74, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x72, 0x6f, 0x6f,
0x6d, 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74,
0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f,
0x52, 0x11, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x47, 0x0a,
0x6e, 0x74, 0x73, 0x22, 0x3e, 0x0a, 0x09, 0x4d, 0x75, 0x74, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61,
0x12, 0x1b, 0x0a, 0x09, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6c, 0x69, 0x76, 0x65,
0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x53, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49,
0x05, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, 0x6e, 0x66, 0x6f, 0x52, 0x11, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63,
0x74, 0x65, 0x64, 0x22, 0x51, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x22, 0x3a, 0x0a, 0x10, 0x4d, 0x75, 0x74, 0x65, 0x54, 0x72,
0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69,
0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05,
0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x6d, 0x75, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6d, 0x75, 0x74,
0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x65, 0x64, 0x22, 0x51, 0x0a, 0x11, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e,
0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x3c, 0x0a, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e,
0x65, 0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70,
0x6f, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69,
0x33, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x6c, 0x69, 0x76, 0x65,
0x6b, 0x69, 0x74, 0x2d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2f, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@@ -630,39 +787,45 @@ func file_rtc_proto_rawDescGZIP() []byte {
return file_rtc_proto_rawDescData return file_rtc_proto_rawDescData
} }
var file_rtc_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_rtc_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_rtc_proto_goTypes = []interface{}{ var file_rtc_proto_goTypes = []interface{}{
(*SignalRequest)(nil), // 0: livekit.SignalRequest (*SignalRequest)(nil), // 0: livekit.SignalRequest
(*SignalResponse)(nil), // 1: livekit.SignalResponse (*SignalResponse)(nil), // 1: livekit.SignalResponse
(*Trickle)(nil), // 2: livekit.Trickle (*AddTrackRequest)(nil), // 2: livekit.AddTrackRequest
(*SessionDescription)(nil), // 3: livekit.SessionDescription (*TrickleRequest)(nil), // 3: livekit.TrickleRequest
(*JoinResponse)(nil), // 4: livekit.JoinResponse (*RemoveTrackRequest)(nil), // 4: livekit.RemoveTrackRequest
(*MuteTrack)(nil), // 5: livekit.MuteTrack (*SessionDescription)(nil), // 5: livekit.SessionDescription
(*ParticipantUpdate)(nil), // 6: livekit.ParticipantUpdate (*JoinResponse)(nil), // 6: livekit.JoinResponse
(*TrackInfo)(nil), // 7: livekit.TrackInfo (*MuteTrackRequest)(nil), // 7: livekit.MuteTrackRequest
(*RoomInfo)(nil), // 8: livekit.RoomInfo (*ParticipantUpdate)(nil), // 8: livekit.ParticipantUpdate
(*ParticipantInfo)(nil), // 9: livekit.ParticipantInfo (*TrackInfo)(nil), // 9: livekit.TrackInfo
(TrackType)(0), // 10: livekit.TrackType
(*RoomInfo)(nil), // 11: livekit.RoomInfo
(*ParticipantInfo)(nil), // 12: livekit.ParticipantInfo
} }
var file_rtc_proto_depIdxs = []int32{ var file_rtc_proto_depIdxs = []int32{
3, // 0: livekit.SignalRequest.offer:type_name -> livekit.SessionDescription 5, // 0: livekit.SignalRequest.offer:type_name -> livekit.SessionDescription
3, // 1: livekit.SignalRequest.negotiate:type_name -> livekit.SessionDescription 5, // 1: livekit.SignalRequest.answer:type_name -> livekit.SessionDescription
2, // 2: livekit.SignalRequest.trickle:type_name -> livekit.Trickle 3, // 2: livekit.SignalRequest.trickle:type_name -> livekit.TrickleRequest
5, // 3: livekit.SignalRequest.mute:type_name -> livekit.MuteTrack 2, // 3: livekit.SignalRequest.add_track:type_name -> livekit.AddTrackRequest
4, // 4: livekit.SignalResponse.join:type_name -> livekit.JoinResponse 7, // 4: livekit.SignalRequest.mute:type_name -> livekit.MuteTrackRequest
3, // 5: livekit.SignalResponse.answer:type_name -> livekit.SessionDescription 4, // 5: livekit.SignalRequest.remove_track:type_name -> livekit.RemoveTrackRequest
3, // 6: livekit.SignalResponse.negotiate:type_name -> livekit.SessionDescription 6, // 6: livekit.SignalResponse.join:type_name -> livekit.JoinResponse
2, // 7: livekit.SignalResponse.trickle:type_name -> livekit.Trickle 5, // 7: livekit.SignalResponse.answer:type_name -> livekit.SessionDescription
6, // 8: livekit.SignalResponse.update:type_name -> livekit.ParticipantUpdate 5, // 8: livekit.SignalResponse.offer:type_name -> livekit.SessionDescription
7, // 9: livekit.SignalResponse.trackPublished:type_name -> livekit.TrackInfo 3, // 9: livekit.SignalResponse.trickle:type_name -> livekit.TrickleRequest
8, // 10: livekit.JoinResponse.room:type_name -> livekit.RoomInfo 8, // 10: livekit.SignalResponse.update:type_name -> livekit.ParticipantUpdate
9, // 11: livekit.JoinResponse.participant:type_name -> livekit.ParticipantInfo 9, // 11: livekit.SignalResponse.track_published:type_name -> livekit.TrackInfo
9, // 12: livekit.JoinResponse.other_participants:type_name -> livekit.ParticipantInfo 10, // 12: livekit.AddTrackRequest.type:type_name -> livekit.TrackType
9, // 13: livekit.ParticipantUpdate.participants:type_name -> livekit.ParticipantInfo 11, // 13: livekit.JoinResponse.room:type_name -> livekit.RoomInfo
14, // [14:14] is the sub-list for method output_type 12, // 14: livekit.JoinResponse.participant:type_name -> livekit.ParticipantInfo
14, // [14:14] is the sub-list for method input_type 12, // 15: livekit.JoinResponse.other_participants:type_name -> livekit.ParticipantInfo
14, // [14:14] is the sub-list for extension type_name 12, // 16: livekit.ParticipantUpdate.participants:type_name -> livekit.ParticipantInfo
14, // [14:14] is the sub-list for extension extendee 17, // [17:17] is the sub-list for method output_type
0, // [0:14] is the sub-list for field type_name 17, // [17:17] is the sub-list for method input_type
17, // [17:17] is the sub-list for extension type_name
17, // [17:17] is the sub-list for extension extendee
0, // [0:17] is the sub-list for field type_name
} }
func init() { file_rtc_proto_init() } func init() { file_rtc_proto_init() }
@@ -697,7 +860,7 @@ func file_rtc_proto_init() {
} }
} }
file_rtc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { file_rtc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Trickle); i { switch v := v.(*AddTrackRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -709,7 +872,7 @@ func file_rtc_proto_init() {
} }
} }
file_rtc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { file_rtc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SessionDescription); i { switch v := v.(*TrickleRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -721,7 +884,7 @@ func file_rtc_proto_init() {
} }
} }
file_rtc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { file_rtc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JoinResponse); i { switch v := v.(*RemoveTrackRequest); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -733,7 +896,7 @@ func file_rtc_proto_init() {
} }
} }
file_rtc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { file_rtc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MuteTrack); i { switch v := v.(*SessionDescription); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@@ -745,6 +908,30 @@ func file_rtc_proto_init() {
} }
} }
file_rtc_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { file_rtc_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JoinResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rtc_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MuteTrackRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_rtc_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ParticipantUpdate); i { switch v := v.(*ParticipantUpdate); i {
case 0: case 0:
return &v.state return &v.state
@@ -759,14 +946,16 @@ func file_rtc_proto_init() {
} }
file_rtc_proto_msgTypes[0].OneofWrappers = []interface{}{ file_rtc_proto_msgTypes[0].OneofWrappers = []interface{}{
(*SignalRequest_Offer)(nil), (*SignalRequest_Offer)(nil),
(*SignalRequest_Negotiate)(nil), (*SignalRequest_Answer)(nil),
(*SignalRequest_Trickle)(nil), (*SignalRequest_Trickle)(nil),
(*SignalRequest_AddTrack)(nil),
(*SignalRequest_Mute)(nil), (*SignalRequest_Mute)(nil),
(*SignalRequest_RemoveTrack)(nil),
} }
file_rtc_proto_msgTypes[1].OneofWrappers = []interface{}{ file_rtc_proto_msgTypes[1].OneofWrappers = []interface{}{
(*SignalResponse_Join)(nil), (*SignalResponse_Join)(nil),
(*SignalResponse_Answer)(nil), (*SignalResponse_Answer)(nil),
(*SignalResponse_Negotiate)(nil), (*SignalResponse_Offer)(nil),
(*SignalResponse_Trickle)(nil), (*SignalResponse_Trickle)(nil),
(*SignalResponse_Update)(nil), (*SignalResponse_Update)(nil),
(*SignalResponse_TrackPublished)(nil), (*SignalResponse_TrackPublished)(nil),
@@ -777,7 +966,7 @@ func file_rtc_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_rtc_proto_rawDesc, RawDescriptor: file_rtc_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 7, NumMessages: 9,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },
+7 -6
View File
@@ -48,15 +48,16 @@ message ParticipantInfo {
repeated TrackInfo tracks = 4; repeated TrackInfo tracks = 4;
} }
enum TrackType {
AUDIO = 0;
VIDEO = 1;
DATA = 2;
}
// describing // describing
message TrackInfo { message TrackInfo {
enum Type {
AUDIO = 0;
VIDEO = 1;
DATA = 2;
}
string sid = 1; string sid = 1;
Type type = 2; TrackType type = 2;
string name = 3; string name = 3;
bool muted = 4; bool muted = 4;
} }
+25 -11
View File
@@ -7,10 +7,14 @@ import "model.proto";
message SignalRequest { message SignalRequest {
oneof message { oneof message {
// participant joining initially
SessionDescription offer = 1; SessionDescription offer = 1;
SessionDescription negotiate = 2; // participant responding to server-issued offers
Trickle trickle = 3; SessionDescription answer = 2;
MuteTrack mute = 4; TrickleRequest trickle = 3;
AddTrackRequest add_track = 4;
MuteTrackRequest mute = 5;
RemoveTrackRequest remove_track = 6;
} }
} }
@@ -20,20 +24,30 @@ message SignalResponse {
JoinResponse join = 1; JoinResponse join = 1;
// sent when offer is answered // sent when offer is answered
SessionDescription answer = 2; SessionDescription answer = 2;
// sent when a negotiated sd is available (could be either offer or answer) // sent when server needs to negotiate, always offer
SessionDescription negotiate = 3; SessionDescription offer = 3;
// sent when an ICE candidate is available // sent when an ICE candidate is available
Trickle trickle = 4; TrickleRequest trickle = 4;
// sent when participants in the room has changed // sent when participants in the room has changed
ParticipantUpdate update = 5; ParticipantUpdate update = 5;
// sent to the participant when their track has been published // sent to the participant when their track has been published
TrackInfo trackPublished = 6; TrackInfo track_published = 6;
} }
} }
message Trickle { message AddTrackRequest {
string candidateInit = 1; string name = 1;
TrackType type = 2;
// client ID of track, to match it when RTC track is received
string cid = 3;
}
message TrickleRequest {
string candidateInit = 1;
}
message RemoveTrackRequest {
string sid = 1;
} }
message SessionDescription { message SessionDescription {
@@ -47,8 +61,8 @@ message JoinResponse {
repeated ParticipantInfo other_participants = 3; repeated ParticipantInfo other_participants = 3;
} }
message MuteTrack { message MuteTrackRequest {
string track_sid = 1; string sid = 1;
bool muted = 2; bool muted = 2;
} }