mirror of
https://github.com/livekit/livekit.git
synced 2026-08-28 09:24:08 +00:00
deps (#3829)
This commit is contained in:
@@ -23,8 +23,8 @@ require (
|
||||
github.com/jxskiss/base62 v1.1.0
|
||||
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731
|
||||
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded
|
||||
github.com/livekit/protocol v1.39.4-0.20250725083335-7313a8195a4b
|
||||
github.com/livekit/psrpc v0.6.1-0.20250724161801-262a822e7cd7
|
||||
github.com/livekit/protocol v1.39.4-0.20250802093152-1b7e38ef9c96
|
||||
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741
|
||||
github.com/mackerelio/go-osstat v0.2.5
|
||||
github.com/magefile/mage v1.15.0
|
||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.11.2
|
||||
@@ -105,7 +105,7 @@ require (
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/moby/term v0.5.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/nats-io/nats.go v1.43.0 // indirect
|
||||
github.com/nats-io/nats.go v1.44.0 // indirect
|
||||
github.com/nats-io/nkeys v0.4.11 // indirect
|
||||
github.com/nats-io/nuid v1.0.1 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
@@ -135,8 +135,8 @@ require (
|
||||
golang.org/x/sys v0.34.0 // indirect
|
||||
golang.org/x/text v0.27.0 // indirect
|
||||
golang.org/x/tools v0.35.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250721164621-a45f3dfb1074 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 // indirect
|
||||
google.golang.org/grpc v1.74.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -167,10 +167,10 @@ github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 h1:9x+U2HGLrSw5AT
|
||||
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
|
||||
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded h1:ylZPdnlX1RW9Z15SD4mp87vT2D2shsk0hpLJwSPcq3g=
|
||||
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded/go.mod h1:mSNtYzSf6iY9xM3UX42VEI+STHvMgHmrYzEHPcdhB8A=
|
||||
github.com/livekit/protocol v1.39.4-0.20250725083335-7313a8195a4b h1:uxvoeGd0vmGDIL0JyLLV9h2o97tpt3rR9s4ikuLVz/g=
|
||||
github.com/livekit/protocol v1.39.4-0.20250725083335-7313a8195a4b/go.mod h1:YlgUxAegtU8jZ0tVXoIV/4fHeHqqLvS+6JnPKDbpFPU=
|
||||
github.com/livekit/psrpc v0.6.1-0.20250724161801-262a822e7cd7 h1:x50axcjXwfwnII7sMhJPyZ6f5LpPapZtsp75KJX8nIQ=
|
||||
github.com/livekit/psrpc v0.6.1-0.20250724161801-262a822e7cd7/go.mod h1:kmD+AZPkWu0MaXIMv57jhNlbiSZZ/Jx4bzlxBDVmJes=
|
||||
github.com/livekit/protocol v1.39.4-0.20250802093152-1b7e38ef9c96 h1:PeGSL1wZKCU+Yizlbvmw60+NHnOWcSE19crqqnAeJgw=
|
||||
github.com/livekit/protocol v1.39.4-0.20250802093152-1b7e38ef9c96/go.mod h1:YlgUxAegtU8jZ0tVXoIV/4fHeHqqLvS+6JnPKDbpFPU=
|
||||
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741 h1:KKL1u94l6dF9u4cBwnnfozk27GH1txWy2SlvkfgmzoY=
|
||||
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741/go.mod h1:AuDC5uOoEjQJEc69v4Li3t77Ocz0e0NdjQEuFfO+vfk=
|
||||
github.com/mackerelio/go-osstat v0.2.5 h1:+MqTbZUhoIt4m8qzkVoXUJg1EuifwlAJSk4Yl2GXh+o=
|
||||
github.com/mackerelio/go-osstat v0.2.5/go.mod h1:atxwWF+POUZcdtR1wnsUcQxTytoHG4uhl2AKKzrOajY=
|
||||
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
|
||||
@@ -212,8 +212,8 @@ github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
|
||||
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/nats-io/nats.go v1.43.0 h1:uRFZ2FEoRvP64+UUhaTokyS18XBCR/xM2vQZKO4i8ug=
|
||||
github.com/nats-io/nats.go v1.43.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g=
|
||||
github.com/nats-io/nats.go v1.44.0 h1:ECKVrDLdh/kDPV1g0gAQ+2+m2KprqZK5O/eJAyAnH2M=
|
||||
github.com/nats-io/nats.go v1.44.0/go.mod h1:iRWIPokVIFbVijxuMQq4y9ttaBTMe0SFdlZfMDd+33g=
|
||||
github.com/nats-io/nkeys v0.4.11 h1:q44qGV008kYd9W1b1nEBkNzvnWxtRSQ7A8BoqRrcfa0=
|
||||
github.com/nats-io/nkeys v0.4.11/go.mod h1:szDimtgmfOi9n25JpfIdGw12tZFYXqhGxjhVxsatHVE=
|
||||
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||
@@ -332,16 +332,16 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
|
||||
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||
go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg=
|
||||
go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E=
|
||||
go.opentelemetry.io/otel/metric v1.36.0 h1:MoWPKVhQvJ+eeXWHFBOPoBOi20jh6Iq2CcCREuTYufE=
|
||||
go.opentelemetry.io/otel/metric v1.36.0/go.mod h1:zC7Ks+yeyJt4xig9DEw9kuUFe5C3zLbVjV2PzT6qzbs=
|
||||
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
|
||||
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
|
||||
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
|
||||
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
|
||||
go.opentelemetry.io/otel/sdk v1.36.0 h1:b6SYIuLRs88ztox4EyrvRti80uXIFy+Sqzoh9kFULbs=
|
||||
go.opentelemetry.io/otel/sdk v1.36.0/go.mod h1:+lC+mTgD+MUWfjJubi2vvXWcVxyr9rmlshZni72pXeY=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.36.0 h1:r0ntwwGosWGaa0CrSt8cuNuTcccMXERFwHX4dThiPis=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.36.0/go.mod h1:qTNOhFDfKRwX0yXOqJYegL5WRaW376QbB7P4Pb0qva4=
|
||||
go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w=
|
||||
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
|
||||
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
|
||||
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
@@ -471,10 +471,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250721164621-a45f3dfb1074 h1:mVXdvnmR3S3BQOqHECm9NGMjYiRtEvDYcqAqedTXY6s=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250721164621-a45f3dfb1074/go.mod h1:vYFwMYFbmA8vl6Z/krj/h7+U/AqpHknwJX4Uqgfyc7I=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 h1:qJW29YvkiJmXOYMu5Tf8lyrTp3dOS+K4z6IixtLaCf8=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0 h1:0UOBWO4dC+e51ui0NFKSPbkHHiQ4TmrEfEZMLDyRmY8=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250728155136-f173205681a0/go.mod h1:8ytArBbtOy2xfht+y2fqKd5DRDJRUQhqbyEnQ4bDChs=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 h1:MAKi5q709QWfnkkpNQ0M12hYJ1+e8qYVDyowc4U1XZM=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||
google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4=
|
||||
google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
|
||||
@@ -73,7 +73,7 @@ type RoomManager struct {
|
||||
router routing.Router
|
||||
roomAllocator RoomAllocator
|
||||
roomManagerServer rpc.TypedRoomManagerServer
|
||||
rtcRestServer rpc.RTCRestServer[livekit.NodeID]
|
||||
whipServer rpc.WHIPServer[livekit.NodeID]
|
||||
roomStore ObjectStore
|
||||
telemetry telemetry.TelemetryService
|
||||
recorder observability.Reporter
|
||||
@@ -91,7 +91,7 @@ type RoomManager struct {
|
||||
agentDispatchServers utils.MultitonService[rpc.RoomTopic]
|
||||
participantServers utils.MultitonService[rpc.ParticipantTopic]
|
||||
httpSignalParticipantServers utils.MultitonService[rpc.ParticipantTopic]
|
||||
rtcRestParticipantServers utils.MultitonService[rpc.ParticipantTopic]
|
||||
whipParticipantServers utils.MultitonService[rpc.ParticipantTopic]
|
||||
|
||||
iceConfigCache *sutils.IceConfigCache[iceConfigCacheKey]
|
||||
|
||||
@@ -157,11 +157,11 @@ func NewLocalRoomManager(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
r.rtcRestServer, err = rpc.NewRTCRestServer[livekit.NodeID](rtcRestService{r}, bus, rpc.WithDefaultServerOptions(conf.PSRPC, logger.GetLogger()))
|
||||
r.whipServer, err = rpc.NewWHIPServer[livekit.NodeID](whipService{r}, bus, rpc.WithDefaultServerOptions(conf.PSRPC, logger.GetLogger()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := r.rtcRestServer.RegisterAllCommonTopics(currentNode.NodeID()); err != nil {
|
||||
if err := r.whipServer.RegisterAllCommonTopics(currentNode.NodeID()); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -236,12 +236,12 @@ func (r *RoomManager) Stop() {
|
||||
}
|
||||
|
||||
r.roomManagerServer.Kill()
|
||||
r.rtcRestServer.Kill()
|
||||
r.whipServer.Kill()
|
||||
r.roomServers.Kill()
|
||||
r.agentDispatchServers.Kill()
|
||||
r.participantServers.Kill()
|
||||
r.httpSignalParticipantServers.Kill()
|
||||
r.rtcRestParticipantServers.Kill()
|
||||
r.whipParticipantServers.Kill()
|
||||
|
||||
if r.rtcConfig != nil {
|
||||
if r.rtcConfig.UDPMux != nil {
|
||||
@@ -512,9 +512,9 @@ func (r *RoomManager) StartSession(
|
||||
}
|
||||
|
||||
if useOneShotSignallingMode {
|
||||
rtcRestParticipantServer := must.Get(rpc.NewTypedRTCRestParticipantServer(rtcRestParticipantService{r}, r.bus))
|
||||
participantServerClosers = append(participantServerClosers, utils.CloseFunc(r.rtcRestParticipantServers.Replace(participantTopic, rtcRestParticipantServer)))
|
||||
if err := rtcRestParticipantServer.RegisterAllCommonTopics(participantTopic); err != nil {
|
||||
whipParticipantServer := must.Get(rpc.NewTypedWHIPParticipantServer(whipParticipantService{r}, r.bus))
|
||||
participantServerClosers = append(participantServerClosers, utils.CloseFunc(r.whipParticipantServers.Replace(participantTopic, whipParticipantServer)))
|
||||
if err := whipParticipantServer.RegisterAllCommonTopics(participantTopic); err != nil {
|
||||
participantServerClosers.Close()
|
||||
pLogger.Errorw("could not join register participant topic for rtc rest participant server", err)
|
||||
_ = participant.Close(true, types.ParticipantCloseReasonMessageBusFailed, false)
|
||||
|
||||
@@ -17,14 +17,14 @@ import (
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
type rtcRestService struct {
|
||||
type whipService struct {
|
||||
*RoomManager
|
||||
}
|
||||
|
||||
func (s rtcRestService) Create(ctx context.Context, req *rpc.RTCRestCreateRequest) (*rpc.RTCRestCreateResponse, error) {
|
||||
func (s whipService) Create(ctx context.Context, req *rpc.WHIPCreateRequest) (*rpc.WHIPCreateResponse, error) {
|
||||
pi, err := routing.ParticipantInitFromStartSession(req.StartSession, s.RoomManager.currentNode.Region())
|
||||
if err != nil {
|
||||
logger.Errorw("rtcRest service: could not create participant init", err)
|
||||
logger.Errorw("whip service: could not create participant init", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -37,28 +37,31 @@ func (s rtcRestService) Create(ctx context.Context, req *rpc.RTCRestCreateReques
|
||||
routing.NewNullMessageSink(livekit.ConnectionID(req.StartSession.ConnectionId)), // no responseSink
|
||||
true, // useOneShotSignallingMode
|
||||
); err != nil {
|
||||
logger.Errorw("rtcRest service: could not start session", err)
|
||||
logger.Errorw("whip service: could not start session", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
room := s.RoomManager.GetRoom(ctx, livekit.RoomName(req.StartSession.RoomName))
|
||||
if room == nil {
|
||||
logger.Errorw("rtcRest service: could not find room", nil, "room", req.StartSession.RoomName)
|
||||
logger.Errorw("whip service: could not find room", nil, "room", req.StartSession.RoomName)
|
||||
return nil, ErrRoomNotFound
|
||||
}
|
||||
|
||||
lp := room.GetParticipant(pi.Identity)
|
||||
if lp == nil {
|
||||
room.Logger().Errorw("rtcRest service: could not find local participant", nil, "participant", pi.Identity)
|
||||
room.Logger().Errorw("whip service: could not find local participant", nil, "participant", pi.Identity)
|
||||
return nil, ErrParticipantNotFound
|
||||
}
|
||||
|
||||
if err := lp.HandleOffer(webrtc.SessionDescription{Type: webrtc.SDPTypeOffer, SDP: req.OfferSdp}, 0); err != nil {
|
||||
lp.GetLogger().Errorw("rtcRest service: could not handle offer", err)
|
||||
lp.GetLogger().Errorw("whip service: could not handle offer", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// wait for subscriptions to resolve
|
||||
// NOTE: this is outside the WHIP spec, but added as a convenience for clients doing
|
||||
// one-shot signalling (i. e. send an offer and get an answer once) to publish and subscribe to
|
||||
// well-known tracks (i. e. remote participant identity and track names are well known)
|
||||
eg, _ := errgroup.WithContext(ctx)
|
||||
for publisherIdentity, trackList := range req.SubscribedParticipantTracks {
|
||||
for _, trackName := range trackList.TrackNames {
|
||||
@@ -74,19 +77,19 @@ func (s rtcRestService) Create(ctx context.Context, req *rpc.RTCRestCreateReques
|
||||
}
|
||||
err = eg.Wait()
|
||||
if err != nil {
|
||||
lp.GetLogger().Errorw("rtcRest service: could not subscribe to tracks", err)
|
||||
lp.GetLogger().Errorw("whip service: could not subscribe to tracks", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
answer, _, err := lp.GetAnswer()
|
||||
if err != nil {
|
||||
lp.GetLogger().Errorw("rtcRest service: could not get answer", err)
|
||||
lp.GetLogger().Errorw("whip service: could not get answer", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
iceSessionID, err := lp.GetPublisherICESessionUfrag()
|
||||
if err != nil {
|
||||
lp.GetLogger().Errorw("rtcRest service: could not get ICE session ID", err)
|
||||
lp.GetLogger().Errorw("whip service: could not get ICE session ID", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -99,7 +102,7 @@ func (s rtcRestService) Create(ctx context.Context, req *rpc.RTCRestCreateReques
|
||||
false,
|
||||
)
|
||||
}
|
||||
return &rpc.RTCRestCreateResponse{
|
||||
return &rpc.WHIPCreateResponse{
|
||||
AnswerSdp: answer.SDP,
|
||||
ParticipantId: string(lp.ID()),
|
||||
IceServers: iceServers,
|
||||
@@ -109,11 +112,11 @@ func (s rtcRestService) Create(ctx context.Context, req *rpc.RTCRestCreateReques
|
||||
|
||||
// -------------------------------------------
|
||||
|
||||
type rtcRestParticipantService struct {
|
||||
type whipParticipantService struct {
|
||||
*RoomManager
|
||||
}
|
||||
|
||||
func (r rtcRestParticipantService) ICETrickle(ctx context.Context, req *rpc.RTCRestParticipantICETrickleRequest) (*emptypb.Empty, error) {
|
||||
func (r whipParticipantService) ICETrickle(ctx context.Context, req *rpc.WHIPParticipantICETrickleRequest) (*emptypb.Empty, error) {
|
||||
room := r.RoomManager.GetRoom(ctx, livekit.RoomName(req.Room))
|
||||
if room == nil {
|
||||
return nil, ErrRoomNotFound
|
||||
@@ -126,7 +129,7 @@ func (r rtcRestParticipantService) ICETrickle(ctx context.Context, req *rpc.RTCR
|
||||
|
||||
iceSessionID, err := lp.GetPublisherICESessionUfrag()
|
||||
if err != nil {
|
||||
lp.GetLogger().Warnw("rtcRestParticipant service ice-trickle: could not get ICE session ufrag", err)
|
||||
lp.GetLogger().Warnw("whipParticipant service ice-trickle: could not get ICE session ufrag", err)
|
||||
return nil, psrpc.NewError(psrpc.Internal, err)
|
||||
}
|
||||
|
||||
@@ -144,7 +147,7 @@ func (r rtcRestParticipantService) ICETrickle(ctx context.Context, req *rpc.RTCR
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
func (r rtcRestParticipantService) ICERestart(ctx context.Context, req *rpc.RTCRestParticipantICERestartRequest) (*rpc.RTCRestParticipantICERestartResponse, error) {
|
||||
func (r whipParticipantService) ICERestart(ctx context.Context, req *rpc.WHIPParticipantICERestartRequest) (*rpc.WHIPParticipantICERestartResponse, error) {
|
||||
room := r.RoomManager.GetRoom(ctx, livekit.RoomName(req.Room))
|
||||
if room == nil {
|
||||
return nil, ErrRoomNotFound
|
||||
@@ -162,17 +165,17 @@ func (r rtcRestParticipantService) ICERestart(ctx context.Context, req *rpc.RTCR
|
||||
|
||||
iceSessionID, err := lp.GetPublisherICESessionUfrag()
|
||||
if err != nil {
|
||||
lp.GetLogger().Warnw("rtcRestParticipant service ice-restart: could not get ICE session ufrag", err)
|
||||
lp.GetLogger().Warnw("whipParticipant service ice-restart: could not get ICE session ufrag", err)
|
||||
return nil, psrpc.NewError(psrpc.Internal, err)
|
||||
}
|
||||
|
||||
return &rpc.RTCRestParticipantICERestartResponse{
|
||||
return &rpc.WHIPParticipantICERestartResponse{
|
||||
IceSessionId: iceSessionID,
|
||||
SdpFragment: sdpFragment,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r rtcRestParticipantService) DeleteSession(ctx context.Context, req *rpc.RTCRestParticipantDeleteSessionRequest) (*emptypb.Empty, error) {
|
||||
func (r whipParticipantService) DeleteSession(ctx context.Context, req *rpc.WHIPParticipantDeleteSessionRequest) (*emptypb.Empty, error) {
|
||||
room := r.RoomManager.GetRoom(ctx, livekit.RoomName(req.Room))
|
||||
if room == nil {
|
||||
return nil, ErrRoomNotFound
|
||||
|
||||
@@ -50,7 +50,7 @@ type LivekitServer struct {
|
||||
ioService *IOInfoService
|
||||
rtcService *RTCService
|
||||
rtcv2Service *RTCv2Service
|
||||
rtcRestService *RTCRestService
|
||||
whipService *WHIPService
|
||||
agentService *AgentService
|
||||
httpServer *http.Server
|
||||
promServer *http.Server
|
||||
@@ -74,7 +74,7 @@ func NewLivekitServer(conf *config.Config,
|
||||
ioService *IOInfoService,
|
||||
rtcService *RTCService,
|
||||
rtcv2Service *RTCv2Service,
|
||||
rtcRestService *RTCRestService,
|
||||
whipService *WHIPService,
|
||||
agentService *AgentService,
|
||||
keyProvider auth.KeyProvider,
|
||||
router routing.Router,
|
||||
@@ -89,7 +89,7 @@ func NewLivekitServer(conf *config.Config,
|
||||
ioService: ioService,
|
||||
rtcService: rtcService,
|
||||
rtcv2Service: rtcv2Service,
|
||||
rtcRestService: rtcRestService,
|
||||
whipService: whipService,
|
||||
agentService: agentService,
|
||||
router: router,
|
||||
roomManager: roomManager,
|
||||
@@ -151,7 +151,7 @@ func NewLivekitServer(conf *config.Config,
|
||||
xtwirp.RegisterServer(mux, sipServer)
|
||||
rtcService.SetupRoutes(mux)
|
||||
rtcv2Service.SetupRoutes(mux)
|
||||
rtcRestService.SetupRoutes(mux)
|
||||
whipService.SetupRoutes(mux)
|
||||
mux.Handle("/agent", agentService)
|
||||
mux.HandleFunc("/", s.defaultHandler)
|
||||
|
||||
|
||||
@@ -42,31 +42,31 @@ const (
|
||||
cParticipantIDPath = "/whip/v1/{participant_id}"
|
||||
)
|
||||
|
||||
type RTCRestService struct {
|
||||
type WHIPService struct {
|
||||
http.Handler
|
||||
|
||||
config *config.Config
|
||||
router routing.Router
|
||||
roomAllocator RoomAllocator
|
||||
client rpc.RTCRestClient[livekit.NodeID]
|
||||
client rpc.WHIPClient[livekit.NodeID]
|
||||
topicFormatter rpc.TopicFormatter
|
||||
participantClient rpc.TypedRTCRestParticipantClient
|
||||
participantClient rpc.TypedWHIPParticipantClient
|
||||
}
|
||||
|
||||
func NewRTCRestService(
|
||||
func NewWHIPService(
|
||||
config *config.Config,
|
||||
router routing.Router,
|
||||
roomAllocator RoomAllocator,
|
||||
clientParams rpc.ClientParams,
|
||||
topicFormatter rpc.TopicFormatter,
|
||||
participantClient rpc.TypedRTCRestParticipantClient,
|
||||
) (*RTCRestService, error) {
|
||||
client, err := rpc.NewRTCRestClient[livekit.NodeID](clientParams.Args())
|
||||
participantClient rpc.TypedWHIPParticipantClient,
|
||||
) (*WHIPService, error) {
|
||||
client, err := rpc.NewWHIPClient[livekit.NodeID](clientParams.Args())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &RTCRestService{
|
||||
return &WHIPService{
|
||||
config: config,
|
||||
router: router,
|
||||
roomAllocator: roomAllocator,
|
||||
@@ -76,7 +76,7 @@ func NewRTCRestService(
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *RTCRestService) SetupRoutes(mux *http.ServeMux) {
|
||||
func (s *WHIPService) SetupRoutes(mux *http.ServeMux) {
|
||||
mux.HandleFunc("GET "+cParticipantPath, s.handleGet)
|
||||
mux.HandleFunc("OPTIONS "+cParticipantPath, s.handleOptions)
|
||||
mux.HandleFunc("POST "+cParticipantPath, s.handleCreate)
|
||||
@@ -85,12 +85,12 @@ func (s *RTCRestService) SetupRoutes(mux *http.ServeMux) {
|
||||
mux.HandleFunc("DELETE "+cParticipantIDPath, s.handleParticipantDelete)
|
||||
}
|
||||
|
||||
func (s *RTCRestService) handleGet(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *WHIPService) handleGet(w http.ResponseWriter, r *http.Request) {
|
||||
// https:/www.rfc-editor.org/rfc/rfc9725.html#name-http-usage
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (s *RTCRestService) handleOptions(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *WHIPService) handleOptions(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "*")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "PATCH, OPTIONS, GET, POST, DELETE")
|
||||
@@ -117,7 +117,7 @@ type createRequest struct {
|
||||
SubscribedParticipantTrackNames map[string][]string
|
||||
}
|
||||
|
||||
func (s *RTCRestService) validateCreate(r *http.Request) (*createRequest, int, error) {
|
||||
func (s *WHIPService) validateCreate(r *http.Request) (*createRequest, int, error) {
|
||||
claims := GetGrants(r.Context())
|
||||
if claims == nil || claims.Video == nil {
|
||||
return nil, http.StatusUnauthorized, rtc.ErrPermissionDenied
|
||||
@@ -199,7 +199,7 @@ func (s *RTCRestService) validateCreate(r *http.Request) (*createRequest, int, e
|
||||
}, http.StatusOK, nil
|
||||
}
|
||||
|
||||
func (s *RTCRestService) handleCreate(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *WHIPService) handleCreate(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Header.Get("Content-type") != "application/sdp" {
|
||||
s.handleError("Create", w, r, http.StatusBadRequest, fmt.Errorf("unsupported content-type: %s", r.Header.Get("Content-type")))
|
||||
return
|
||||
@@ -231,14 +231,14 @@ func (s *RTCRestService) handleCreate(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
subscribedParticipantTracks := map[string]*rpc.RTCRestCreateRequest_TrackList{}
|
||||
subscribedParticipantTracks := map[string]*rpc.WHIPCreateRequest_TrackList{}
|
||||
for identity, trackNames := range req.SubscribedParticipantTrackNames {
|
||||
subscribedParticipantTracks[identity] = &rpc.RTCRestCreateRequest_TrackList{
|
||||
subscribedParticipantTracks[identity] = &rpc.WHIPCreateRequest_TrackList{
|
||||
TrackNames: trackNames,
|
||||
}
|
||||
}
|
||||
|
||||
res, err := s.client.Create(r.Context(), livekit.NodeID(rtcNode.Id), &rpc.RTCRestCreateRequest{
|
||||
res, err := s.client.Create(r.Context(), livekit.NodeID(rtcNode.Id), &rpc.WHIPCreateRequest{
|
||||
OfferSdp: req.OfferSDP,
|
||||
StartSession: starSession,
|
||||
SubscribedParticipantTracks: subscribedParticipantTracks,
|
||||
@@ -291,7 +291,7 @@ func (s *RTCRestService) handleCreate(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(res.AnswerSdp))
|
||||
|
||||
sutils.GetLogger(r.Context()).Infow(
|
||||
"API RTCRest.Create",
|
||||
"API WHIP.Create",
|
||||
"connID", connID,
|
||||
"participant", req.ParticipantInit.Identity,
|
||||
"room", req.RoomName,
|
||||
@@ -301,12 +301,12 @@ func (s *RTCRestService) handleCreate(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
func (s *RTCRestService) handleParticipantGet(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *WHIPService) handleParticipantGet(w http.ResponseWriter, r *http.Request) {
|
||||
// https:/www.rfc-editor.org/rfc/rfc9725.html#name-http-usage
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (s *RTCRestService) iceTrickle(
|
||||
func (s *WHIPService) iceTrickle(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
roomName livekit.RoomName,
|
||||
@@ -318,7 +318,7 @@ func (s *RTCRestService) iceTrickle(
|
||||
_, err := s.participantClient.ICETrickle(
|
||||
r.Context(),
|
||||
s.topicFormatter.ParticipantTopic(r.Context(), roomName, participantIdentity),
|
||||
&rpc.RTCRestParticipantICETrickleRequest{
|
||||
&rpc.WHIPParticipantICETrickleRequest{
|
||||
Room: string(roomName),
|
||||
ParticipantIdentity: string(participantIdentity),
|
||||
ParticipantId: string(pID),
|
||||
@@ -349,7 +349,7 @@ func (s *RTCRestService) iceTrickle(
|
||||
return
|
||||
}
|
||||
sutils.GetLogger(r.Context()).Infow(
|
||||
"API RTCRest.Patch",
|
||||
"API WHIP.Patch",
|
||||
"method", "ice-trickle",
|
||||
"room", roomName,
|
||||
"participant", participantIdentity,
|
||||
@@ -360,7 +360,7 @@ func (s *RTCRestService) iceTrickle(
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (s *RTCRestService) iceRestart(
|
||||
func (s *WHIPService) iceRestart(
|
||||
w http.ResponseWriter,
|
||||
r *http.Request,
|
||||
roomName livekit.RoomName,
|
||||
@@ -371,7 +371,7 @@ func (s *RTCRestService) iceRestart(
|
||||
res, err := s.participantClient.ICERestart(
|
||||
r.Context(),
|
||||
s.topicFormatter.ParticipantTopic(r.Context(), roomName, participantIdentity),
|
||||
&rpc.RTCRestParticipantICERestartRequest{
|
||||
&rpc.WHIPParticipantICERestartRequest{
|
||||
Room: string(roomName),
|
||||
ParticipantIdentity: string(participantIdentity),
|
||||
ParticipantId: string(pID),
|
||||
@@ -401,7 +401,7 @@ func (s *RTCRestService) iceRestart(
|
||||
return
|
||||
}
|
||||
sutils.GetLogger(r.Context()).Infow(
|
||||
"API RTCRest.Patch",
|
||||
"API WHIP.Patch",
|
||||
"method", "ice-restart",
|
||||
"room", roomName,
|
||||
"participant", participantIdentity,
|
||||
@@ -417,7 +417,7 @@ func (s *RTCRestService) iceRestart(
|
||||
w.Write([]byte(res.SdpFragment))
|
||||
}
|
||||
|
||||
func (s *RTCRestService) handleParticipantPatch(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *WHIPService) handleParticipantPatch(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Header.Get("Content-type") != "application/trickle-ice-sdpfrag" {
|
||||
s.handleError("Patch", w, r, http.StatusBadRequest, fmt.Errorf("unsupported content-type: %s", r.Header.Get("Content-type")))
|
||||
return
|
||||
@@ -470,7 +470,7 @@ func (s *RTCRestService) handleParticipantPatch(w http.ResponseWriter, r *http.R
|
||||
}
|
||||
}
|
||||
|
||||
func (s *RTCRestService) handleParticipantDelete(w http.ResponseWriter, r *http.Request) {
|
||||
func (s *WHIPService) handleParticipantDelete(w http.ResponseWriter, r *http.Request) {
|
||||
claims := GetGrants(r.Context())
|
||||
if claims == nil || claims.Video == nil {
|
||||
s.handleError("Delete", w, r, http.StatusUnauthorized, rtc.ErrPermissionDenied)
|
||||
@@ -494,7 +494,7 @@ func (s *RTCRestService) handleParticipantDelete(w http.ResponseWriter, r *http.
|
||||
_, err = s.participantClient.DeleteSession(
|
||||
r.Context(),
|
||||
s.topicFormatter.ParticipantTopic(r.Context(), roomName, livekit.ParticipantIdentity(claims.Identity)),
|
||||
&rpc.RTCRestParticipantDeleteSessionRequest{
|
||||
&rpc.WHIPParticipantDeleteSessionRequest{
|
||||
Room: string(roomName),
|
||||
ParticipantIdentity: claims.Identity,
|
||||
ParticipantId: r.PathValue("participant_id"),
|
||||
@@ -506,7 +506,7 @@ func (s *RTCRestService) handleParticipantDelete(w http.ResponseWriter, r *http.
|
||||
}
|
||||
|
||||
sutils.GetLogger(r.Context()).Infow(
|
||||
"API RTCRest.Delete",
|
||||
"API WHIP.Delete",
|
||||
"participant", claims.Identity,
|
||||
"pID", r.PathValue("participant_id"),
|
||||
"room", roomName,
|
||||
@@ -515,9 +515,9 @@ func (s *RTCRestService) handleParticipantDelete(w http.ResponseWriter, r *http.
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
func (s *RTCRestService) handleError(method string, w http.ResponseWriter, r *http.Request, status int, err error) {
|
||||
func (s *WHIPService) handleError(method string, w http.ResponseWriter, r *http.Request, status int, err error) {
|
||||
sutils.GetLogger(r.Context()).Warnw(
|
||||
fmt.Sprintf("API RTCRest.%s", method), err,
|
||||
fmt.Sprintf("API WHIP.%s", method), err,
|
||||
"status", status,
|
||||
)
|
||||
w.WriteHeader(status)
|
||||
+2
-2
@@ -78,7 +78,7 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
NewRoomService,
|
||||
NewRTCService,
|
||||
NewRTCv2Service,
|
||||
NewRTCRestService,
|
||||
NewWHIPService,
|
||||
NewAgentService,
|
||||
NewAgentDispatchService,
|
||||
agent.NewAgentClient,
|
||||
@@ -96,7 +96,7 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
rpc.NewTypedRoomClient,
|
||||
rpc.NewTypedParticipantClient,
|
||||
rpc.NewTypedSignalv2ParticipantClient,
|
||||
rpc.NewTypedRTCRestParticipantClient,
|
||||
rpc.NewTypedWHIPParticipantClient,
|
||||
rpc.NewTypedAgentDispatchInternalClient,
|
||||
NewLocalRoomManager,
|
||||
NewTURNAuthHandler,
|
||||
|
||||
@@ -125,11 +125,11 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
return nil, err
|
||||
}
|
||||
rtCv2Service := NewRTCv2Service(conf, roomAllocator, router, topicFormatter, signalv2ParticipantClient)
|
||||
rtcRestParticipantClient, err := rpc.NewTypedRTCRestParticipantClient(clientParams)
|
||||
whipParticipantClient, err := rpc.NewTypedWHIPParticipantClient(clientParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
serviceRTCRestService, err := NewRTCRestService(conf, router, roomAllocator, clientParams, topicFormatter, rtcRestParticipantClient)
|
||||
serviceWHIPService, err := NewWHIPService(conf, router, roomAllocator, clientParams, topicFormatter, whipParticipantClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -162,7 +162,7 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
livekitServer, err := NewLivekitServer(conf, roomService, agentDispatchService, egressService, ingressService, sipService, ioInfoService, rtcService, rtCv2Service, serviceRTCRestService, agentService, keyProvider, router, roomManager, signalServer, signalv2Server, server, currentNode)
|
||||
livekitServer, err := NewLivekitServer(conf, roomService, agentDispatchService, egressService, ingressService, sipService, ioInfoService, rtcService, rtCv2Service, serviceWHIPService, agentService, keyProvider, router, roomManager, signalServer, signalv2Server, server, currentNode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user