Use RequestResponse to report protocol handling errors (#3895)

* Send errors as necessary

* WIP

* WIP

* WIP

* WIP

* deps

* static check

* fix test

* test

* test

* logs
This commit is contained in:
Raja Subramanian
2025-09-04 11:27:07 +05:30
committed by GitHub
parent 98352fd0f9
commit 07c40cf349
16 changed files with 422 additions and 386 deletions
+12 -7
View File
@@ -1,6 +1,6 @@
module github.com/livekit/livekit-server module github.com/livekit/livekit-server
go 1.23.4 go 1.24.0
toolchain go1.24.6 toolchain go1.24.6
@@ -23,8 +23,8 @@ require (
github.com/jxskiss/base62 v1.1.0 github.com/jxskiss/base62 v1.1.0
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731
github.com/livekit/mediatransportutil v0.0.0-20250825135402-7bc31f107ade github.com/livekit/mediatransportutil v0.0.0-20250825135402-7bc31f107ade
github.com/livekit/protocol v1.40.1-0.20250826073447-c714707269e5 github.com/livekit/protocol v1.41.1-0.20250902155548-e46b3f58f6a7
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741 github.com/livekit/psrpc v0.6.1-0.20250828235857-3fafdbbcbe55
github.com/mackerelio/go-osstat v0.2.6 github.com/mackerelio/go-osstat v0.2.6
github.com/magefile/mage v1.15.0 github.com/magefile/mage v1.15.0
github.com/maxbrunsfeld/counterfeiter/v6 v6.11.3 github.com/maxbrunsfeld/counterfeiter/v6 v6.11.3
@@ -38,7 +38,7 @@ require (
github.com/pion/rtcp v1.2.15 github.com/pion/rtcp v1.2.15
github.com/pion/rtp v1.8.21 github.com/pion/rtp v1.8.21
github.com/pion/sctp v1.8.39 github.com/pion/sctp v1.8.39
github.com/pion/sdp/v3 v3.0.15 github.com/pion/sdp/v3 v3.0.16
github.com/pion/transport/v3 v3.0.7 github.com/pion/transport/v3 v3.0.7
github.com/pion/turn/v4 v4.1.1 github.com/pion/turn/v4 v4.1.1
github.com/pion/webrtc/v4 v4.1.5-0.20250828044558-c376d0edf977 github.com/pion/webrtc/v4 v4.1.5-0.20250828044558-c376d0edf977
@@ -63,8 +63,13 @@ require (
) )
require ( require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.1.0 // indirect github.com/go-viper/mapstructure/v2 v2.1.0 // indirect
github.com/moby/sys/user v0.3.0 // indirect github.com/moby/sys/user v0.3.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
) )
require ( require (
@@ -92,7 +97,7 @@ require (
github.com/go-jose/go-jose/v3 v3.0.4 // indirect github.com/go-jose/go-jose/v3 v3.0.4 // indirect
github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/logr v1.4.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/cel-go v0.26.0 // indirect github.com/google/cel-go v0.26.1 // indirect
github.com/google/go-cmp v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/subcommands v1.2.0 // indirect github.com/google/subcommands v1.2.0 // indirect
@@ -139,8 +144,8 @@ require (
golang.org/x/sys v0.35.0 // indirect golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect golang.org/x/text v0.28.0 // indirect
golang.org/x/tools v0.36.0 // indirect golang.org/x/tools v0.36.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1 // indirect
google.golang.org/grpc v1.75.0 // indirect google.golang.org/grpc v1.75.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
) )
+15 -14
View File
@@ -79,6 +79,7 @@ github.com/gammazero/workerpool v1.1.3 h1:WixN4xzukFoN0XSeXF6puqEqFTl2mECI9S6W44
github.com/gammazero/workerpool v1.1.3/go.mod h1:wPjyBLDbyKnUn2XwwyD3EEwo9dHutia9/fwNmSHWACc= github.com/gammazero/workerpool v1.1.3/go.mod h1:wPjyBLDbyKnUn2XwwyD3EEwo9dHutia9/fwNmSHWACc=
github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY= github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=
github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ= github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
@@ -91,8 +92,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/cel-go v0.26.0 h1:DPGjXackMpJWH680oGY4lZhYjIameYmR+/6RBdDGmaI= github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ=
github.com/google/cel-go v0.26.0/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
@@ -170,10 +171,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/mageutil v0.0.0-20250511045019-0f1ff63f7731/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
github.com/livekit/mediatransportutil v0.0.0-20250825135402-7bc31f107ade h1:lpxPcglwzUWNB4J0S2qZuyMehzmR7vW9whzSwV4IGoI= github.com/livekit/mediatransportutil v0.0.0-20250825135402-7bc31f107ade h1:lpxPcglwzUWNB4J0S2qZuyMehzmR7vW9whzSwV4IGoI=
github.com/livekit/mediatransportutil v0.0.0-20250825135402-7bc31f107ade/go.mod h1:mSNtYzSf6iY9xM3UX42VEI+STHvMgHmrYzEHPcdhB8A= github.com/livekit/mediatransportutil v0.0.0-20250825135402-7bc31f107ade/go.mod h1:mSNtYzSf6iY9xM3UX42VEI+STHvMgHmrYzEHPcdhB8A=
github.com/livekit/protocol v1.40.1-0.20250826073447-c714707269e5 h1:aBqHlrgCI3qzVUAoOx7n5Kt8GQ8g7UbNp69fUt2gO8I= github.com/livekit/protocol v1.41.1-0.20250902155548-e46b3f58f6a7 h1:61Guoe3mkqaWRteFiNkAcaXVca9PqUijq8xEjSfoifI=
github.com/livekit/protocol v1.40.1-0.20250826073447-c714707269e5/go.mod h1:YlgUxAegtU8jZ0tVXoIV/4fHeHqqLvS+6JnPKDbpFPU= github.com/livekit/protocol v1.41.1-0.20250902155548-e46b3f58f6a7/go.mod h1:Scx8arfj5y65w6EYA3ZIKJafoN2xBuV8pauvyrvI4eg=
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741 h1:KKL1u94l6dF9u4cBwnnfozk27GH1txWy2SlvkfgmzoY= github.com/livekit/psrpc v0.6.1-0.20250828235857-3fafdbbcbe55 h1:6/iy4APnZZDmtDOxoqv3/eo5hxhpaA/M0ND75XqL7aA=
github.com/livekit/psrpc v0.6.1-0.20250726180611-3915e005e741/go.mod h1:AuDC5uOoEjQJEc69v4Li3t77Ocz0e0NdjQEuFfO+vfk= github.com/livekit/psrpc v0.6.1-0.20250828235857-3fafdbbcbe55/go.mod h1:AuDC5uOoEjQJEc69v4Li3t77Ocz0e0NdjQEuFfO+vfk=
github.com/mackerelio/go-osstat v0.2.6 h1:gs4U8BZeS1tjrL08tt5VUliVvSWP26Ai2Ob8Lr7f2i0= github.com/mackerelio/go-osstat v0.2.6 h1:gs4U8BZeS1tjrL08tt5VUliVvSWP26Ai2Ob8Lr7f2i0=
github.com/mackerelio/go-osstat v0.2.6/go.mod h1:lRy8V9ZuHpuRVZh+vyTkODeDPl3/d5MgXHtLSaqG8bA= github.com/mackerelio/go-osstat v0.2.6/go.mod h1:lRy8V9ZuHpuRVZh+vyTkODeDPl3/d5MgXHtLSaqG8bA=
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
@@ -253,8 +254,8 @@ github.com/pion/rtp v1.8.21 h1:3yrOwmZFyUpcIosNcWRpQaU+UXIJ6yxLuJ8Bx0mw37Y=
github.com/pion/rtp v1.8.21/go.mod h1:bAu2UFKScgzyFqvUKmbvzSdPr+NGbZtv6UB2hesqXBk= github.com/pion/rtp v1.8.21/go.mod h1:bAu2UFKScgzyFqvUKmbvzSdPr+NGbZtv6UB2hesqXBk=
github.com/pion/sctp v1.8.39 h1:PJma40vRHa3UTO3C4MyeJDQ+KIobVYRZQZ0Nt7SjQnE= github.com/pion/sctp v1.8.39 h1:PJma40vRHa3UTO3C4MyeJDQ+KIobVYRZQZ0Nt7SjQnE=
github.com/pion/sctp v1.8.39/go.mod h1:cNiLdchXra8fHQwmIoqw0MbLLMs+f7uQ+dGMG2gWebE= github.com/pion/sctp v1.8.39/go.mod h1:cNiLdchXra8fHQwmIoqw0MbLLMs+f7uQ+dGMG2gWebE=
github.com/pion/sdp/v3 v3.0.15 h1:F0I1zds+K/+37ZrzdADmx2Q44OFDOPRLhPnNTaUX9hk= github.com/pion/sdp/v3 v3.0.16 h1:0dKzYO6gTAvuLaAKQkC02eCPjMIi4NuAr/ibAwrGDCo=
github.com/pion/sdp/v3 v3.0.15/go.mod h1:88GMahN5xnScv1hIMTqLdu/cOcUkj6a9ytbncwMCq2E= github.com/pion/sdp/v3 v3.0.16/go.mod h1:9tyKzznud3qiweZcD86kS0ff1pGYB3VX+Bcsmkx6IXo=
github.com/pion/srtp/v3 v3.0.7 h1:QUElw0A/FUg3MP8/KNMZB3i0m8F9XeMnTum86F7S4bs= github.com/pion/srtp/v3 v3.0.7 h1:QUElw0A/FUg3MP8/KNMZB3i0m8F9XeMnTum86F7S4bs=
github.com/pion/srtp/v3 v3.0.7/go.mod h1:qvnHeqbhT7kDdB+OGB05KA/P067G3mm7XBfLaLiaNF0= github.com/pion/srtp/v3 v3.0.7/go.mod h1:qvnHeqbhT7kDdB+OGB05KA/P067G3mm7XBfLaLiaNF0=
github.com/pion/stun/v3 v3.0.0 h1:4h1gwhWLWuZWOJIJR9s2ferRO+W3zA/b6ijOI6mKzUw= github.com/pion/stun/v3 v3.0.0 h1:4h1gwhWLWuZWOJIJR9s2ferRO+W3zA/b6ijOI6mKzUw=
@@ -282,8 +283,8 @@ github.com/puzpuzpuz/xsync/v3 v3.5.1/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPK
github.com/redis/go-redis/v9 v9.12.1 h1:k5iquqv27aBtnTm2tIkROUDp8JBXhXZIVu1InSgvovg= github.com/redis/go-redis/v9 v9.12.1 h1:k5iquqv27aBtnTm2tIkROUDp8JBXhXZIVu1InSgvovg=
github.com/redis/go-redis/v9 v9.12.1/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw= github.com/redis/go-redis/v9 v9.12.1/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8= github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
@@ -476,10 +477,10 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY= google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1 h1:APHvLLYBhtZvsbnpkfknDZ7NyH4z5+ub/I0u8L3Oz6g=
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE= google.golang.org/genproto/googleapis/api v0.0.0-20250826171959-ef028d996bc1/go.mod h1:xUjFWUnWDpZ/C0Gu0qloASKFb6f8/QXiiXhSPFsD668=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE= google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1 h1:pmJpJEvT846VzausCQ5d7KreSROcDqmO388w5YbnltA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc= google.golang.org/genproto/googleapis/rpc v0.0.0-20250826171959-ef028d996bc1/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og=
google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4= google.golang.org/grpc v1.75.0 h1:+TW+dqTd2Biwe6KKfhE5JpiYIBWq865PhKGSXiivqt4=
google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= google.golang.org/grpc v1.75.0/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
+5 -5
View File
@@ -49,7 +49,7 @@ func (c ClientInfo) SupportsAudioRED() bool {
return !c.isFirefox() && !c.isSafari() return !c.isFirefox() && !c.isSafari()
} }
func (c ClientInfo) SupportPrflxOverRelay() bool { func (c ClientInfo) SupportsPrflxOverRelay() bool {
return !c.isFirefox() return !c.isFirefox()
} }
@@ -97,15 +97,15 @@ func (c ClientInfo) ComplyWithCodecOrderInSDPAnswer() bool {
} }
// Rust SDK can't decode unknown signal message (TrackSubscribed and ErrorResponse) // Rust SDK can't decode unknown signal message (TrackSubscribed and ErrorResponse)
func (c ClientInfo) SupportTrackSubscribedEvent() bool { func (c ClientInfo) SupportsTrackSubscribedEvent() bool {
return !(c.ClientInfo.GetSdk() == livekit.ClientInfo_RUST && c.ClientInfo.GetProtocol() < 10) return !(c.ClientInfo.GetSdk() == livekit.ClientInfo_RUST && c.ClientInfo.GetProtocol() < 10)
} }
func (c ClientInfo) SupportErrorResponse() bool { func (c ClientInfo) SupportsRequestResponse() bool {
return c.SupportTrackSubscribedEvent() return c.SupportsTrackSubscribedEvent()
} }
func (c ClientInfo) SupportSctpZeroChecksum() bool { func (c ClientInfo) SupportsSctpZeroChecksum() bool {
return !(c.ClientInfo.GetSdk() == livekit.ClientInfo_UNKNOWN || return !(c.ClientInfo.GetSdk() == livekit.ClientInfo_UNKNOWN ||
(c.isGo() && c.compareVersion("2.4.0") < 0)) (c.isGo() && c.compareVersion("2.4.0") < 0))
} }
+164 -32
View File
@@ -40,7 +40,8 @@ import (
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
"github.com/livekit/protocol/observability" "github.com/livekit/protocol/observability"
"github.com/livekit/protocol/observability/roomobs" "github.com/livekit/protocol/observability/roomobs"
sdpHelper "github.com/livekit/protocol/sdp" protosdp "github.com/livekit/protocol/sdp"
protosignalling "github.com/livekit/protocol/signalling"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid" "github.com/livekit/protocol/utils/guid"
"github.com/livekit/protocol/utils/pointer" "github.com/livekit/protocol/utils/pointer"
@@ -63,6 +64,8 @@ import (
sutils "github.com/livekit/livekit-server/pkg/utils" sutils "github.com/livekit/livekit-server/pkg/utils"
) )
var _ types.LocalParticipant = (*ParticipantImpl)(nil)
const ( const (
sdBatchSize = 30 sdBatchSize = 30
rttUpdateInterval = 5 * time.Second rttUpdateInterval = 5 * time.Second
@@ -549,8 +552,8 @@ func (p *ParticipantImpl) GetBufferFactory() *buffer.Factory {
return p.params.Config.BufferFactory return p.params.Config.BufferFactory
} }
// CheckMetadataLimits check if name/metadata/attributes of a participant is within configured limits // checkMetadataLimits check if name/metadata/attributes of a participant is within configured limits
func (p *ParticipantImpl) CheckMetadataLimits( func (p *ParticipantImpl) checkMetadataLimits(
name string, name string,
metadata string, metadata string,
attributes map[string]string, attributes map[string]string,
@@ -570,6 +573,64 @@ func (p *ParticipantImpl) CheckMetadataLimits(
return nil return nil
} }
func (p *ParticipantImpl) UpdateMetadata(update *livekit.UpdateParticipantMetadata, fromAdmin bool) error {
lgr := p.params.Logger.WithUnlikelyValues(
"update", logger.Proto(update),
"fromAdmin", fromAdmin,
)
lgr.Debugw("updating participant metadata")
var err error
requestResponse := &livekit.RequestResponse{}
sendRequestResponse := func() error {
if !fromAdmin || (update.RequestId != 0 || err != nil) {
requestResponse.Request = &livekit.RequestResponse_UpdateMetadata{
UpdateMetadata: utils.CloneProto(update),
}
p.sendRequestResponse(requestResponse)
}
if err != nil {
lgr.Warnw("could not update metadata", err)
}
return err
}
if !fromAdmin && !p.ClaimGrants().Video.GetCanUpdateOwnMetadata() {
requestResponse.Reason = livekit.RequestResponse_NOT_ALLOWED
requestResponse.Message = "does not have permission to update own metadata"
err = signalling.ErrUpdateOwnMetadataNotAllowed
return sendRequestResponse()
}
if err = p.checkMetadataLimits(update.Name, update.Metadata, update.Attributes); err != nil {
switch err {
case signalling.ErrNameExceedsLimits:
requestResponse.Reason = livekit.RequestResponse_LIMIT_EXCEEDED
requestResponse.Message = "exceeds name length limit"
case signalling.ErrMetadataExceedsLimits:
requestResponse.Reason = livekit.RequestResponse_LIMIT_EXCEEDED
requestResponse.Message = "exceeds metadata size limit"
case signalling.ErrAttributesExceedsLimits:
requestResponse.Reason = livekit.RequestResponse_LIMIT_EXCEEDED
requestResponse.Message = "exceeds attributes size limit"
}
return sendRequestResponse()
}
if update.Name != "" {
p.SetName(update.Name)
}
if update.Metadata != "" {
p.SetMetadata(update.Metadata)
}
if update.Attributes != nil {
p.SetAttributes(update.Attributes)
}
return sendRequestResponse()
}
// SetName attaches name to the participant // SetName attaches name to the participant
func (p *ParticipantImpl) SetName(name string) { func (p *ParticipantImpl) SetName(name string) {
p.lock.Lock() p.lock.Lock()
@@ -1018,12 +1079,12 @@ func (p *ParticipantImpl) synthesizeAddTrackRequests(parsedOffer *sdp.SessionDes
continue continue
} }
cid := sdpHelper.GetMediaStreamTrack(m) cid := protosdp.GetMediaStreamTrack(m)
if cid == "" { if cid == "" {
cid = guid.New(utils.TrackPrefix) cid = guid.New(utils.TrackPrefix)
} }
rids, ridsOk := sdpHelper.GetSimulcastRids(m) rids, ridsOk := protosdp.GetSimulcastRids(m)
var ( var (
name string name string
@@ -1072,14 +1133,14 @@ func (p *ParticipantImpl) updateRidsFromSDP(parsed *sdp.SessionDescription, unma
continue continue
} }
mst := sdpHelper.GetMediaStreamTrack(m) mst := protosdp.GetMediaStreamTrack(m)
if mst == "" { if mst == "" {
continue continue
} }
getRids := func(inRids buffer.VideoLayersRid) buffer.VideoLayersRid { getRids := func(inRids buffer.VideoLayersRid) buffer.VideoLayersRid {
var outRids buffer.VideoLayersRid var outRids buffer.VideoLayersRid
rids, ok := sdpHelper.GetSimulcastRids(m) rids, ok := protosdp.GetSimulcastRids(m)
if ok { if ok {
n := min(len(rids), len(inRids)) n := min(len(rids), len(inRids))
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
@@ -1149,28 +1210,43 @@ func (p *ParticipantImpl) updateRidsFromSDP(parsed *sdp.SessionDescription, unma
} }
} }
func (p *ParticipantImpl) HandleICETrickle(trickleRequest *livekit.TrickleRequest) {
candidateInit, err := protosignalling.FromProtoTrickle(trickleRequest)
if err != nil {
p.params.Logger.Warnw("could not decode trickle", err)
p.sendRequestResponse(&livekit.RequestResponse{
Reason: livekit.RequestResponse_UNCLASSIFIED_ERROR,
Message: err.Error(),
Request: &livekit.RequestResponse_Trickle{
Trickle: utils.CloneProto(trickleRequest),
},
})
return
}
p.TransportManager.AddICECandidate(candidateInit, trickleRequest.Target)
}
// HandleOffer an offer from remote participant, used when clients make the initial connection // HandleOffer an offer from remote participant, used when clients make the initial connection
func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription, offerId uint32) error { func (p *ParticipantImpl) HandleOffer(sd *livekit.SessionDescription) error {
p.pubLogger.Debugw( offer, offerId := protosignalling.FromProtoSessionDescription(sd)
"received offer", lgr := p.pubLogger.WithUnlikelyValues(
"transport", livekit.SignalTarget_PUBLISHER, "transport", livekit.SignalTarget_PUBLISHER,
"offer", offer, "offer", offer,
"offerId", offerId, "offerId", offerId,
) )
lgr.Debugw("received offer")
parsedOffer, err := offer.Unmarshal() parsedOffer, err := offer.Unmarshal()
if err != nil { if err != nil {
p.pubLogger.Warnw( lgr.Warnw("could not parse offer", err)
"could not parse offer", err,
"transport", livekit.SignalTarget_PUBLISHER,
"offer", offer,
"offerId", offerId,
)
return err return err
} }
if p.params.UseOneShotSignallingMode { if p.params.UseOneShotSignallingMode {
if err := p.synthesizeAddTrackRequests(parsedOffer); err != nil { if err := p.synthesizeAddTrackRequests(parsedOffer); err != nil {
lgr.Warnw("could not synthesize add track requests", err)
return err return err
} }
} }
@@ -1182,7 +1258,7 @@ func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription, offerId u
// put together munged offer after setting codec preferences // put together munged offer after setting codec preferences
bytes, err := parsedOffer.Marshal() bytes, err := parsedOffer.Marshal()
if err != nil { if err != nil {
p.pubLogger.Errorw("failed to marshal offer", err) lgr.Errorw("failed to marshal offer", err, "parsedOffer", parsedOffer)
return err return err
} }
@@ -1193,6 +1269,7 @@ func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription, offerId u
err = p.TransportManager.HandleOffer(offer, offerId, p.MigrateState() == types.MigrateStateInit) err = p.TransportManager.HandleOffer(offer, offerId, p.MigrateState() == types.MigrateStateInit)
if err != nil { if err != nil {
lgr.Warnw("could not handle offer", err, "mungedOffer", offer)
return err return err
} }
@@ -1203,7 +1280,7 @@ func (p *ParticipantImpl) HandleOffer(offer webrtc.SessionDescription, offerId u
} }
p.handlePendingRemoteTracks() p.handlePendingRemoteTracks()
return err return nil
} }
func (p *ParticipantImpl) onPublisherAnswer(answer webrtc.SessionDescription, answerId uint32) error { func (p *ParticipantImpl) onPublisherAnswer(answer webrtc.SessionDescription, answerId uint32) error {
@@ -1243,7 +1320,8 @@ func (p *ParticipantImpl) GetAnswer() (webrtc.SessionDescription, uint32, error)
// HandleAnswer handles a client answer response, with subscriber PC, server initiates the // HandleAnswer handles a client answer response, with subscriber PC, server initiates the
// offer and client answers // offer and client answers
func (p *ParticipantImpl) HandleAnswer(answer webrtc.SessionDescription, answerId uint32) { func (p *ParticipantImpl) HandleAnswer(sd *livekit.SessionDescription) {
answer, answerId := protosignalling.FromProtoSessionDescription(sd)
p.subLogger.Debugw( p.subLogger.Debugw(
"received answer", "received answer",
"transport", livekit.SignalTarget_SUBSCRIBER, "transport", livekit.SignalTarget_SUBSCRIBER,
@@ -1307,11 +1385,23 @@ func (p *ParticipantImpl) AddTrack(req *livekit.AddTrackRequest) {
p.params.Logger.Debugw("add track request", "trackID", req.Cid, "request", logger.Proto(req)) p.params.Logger.Debugw("add track request", "trackID", req.Cid, "request", logger.Proto(req))
if !p.CanPublishSource(req.Source) { if !p.CanPublishSource(req.Source) {
p.pubLogger.Warnw("no permission to publish track", nil, "trackID", req.Sid, "kind", req.Type) p.pubLogger.Warnw("no permission to publish track", nil, "trackID", req.Sid, "kind", req.Type)
p.sendRequestResponse(&livekit.RequestResponse{
Reason: livekit.RequestResponse_NOT_ALLOWED,
Request: &livekit.RequestResponse_AddTrack{
AddTrack: utils.CloneProto(req),
},
})
return return
} }
if req.Type != livekit.TrackType_AUDIO && req.Type != livekit.TrackType_VIDEO { if req.Type != livekit.TrackType_AUDIO && req.Type != livekit.TrackType_VIDEO {
p.pubLogger.Warnw("unsupported track type", nil, "trackID", req.Sid, "kind", req.Type) p.pubLogger.Warnw("unsupported track type", nil, "trackID", req.Sid, "kind", req.Type)
p.sendRequestResponse(&livekit.RequestResponse{
Reason: livekit.RequestResponse_UNSUPPORTED_TYPE,
Request: &livekit.RequestResponse_AddTrack{
AddTrack: utils.CloneProto(req),
},
})
return return
} }
@@ -2290,9 +2380,13 @@ func (p *ParticipantImpl) onReceivedDataMessage(kind livekit.DataPacket_Kind, da
// waiting time out, handle all cached messages // waiting time out, handle all cached messages
cachedMsgs := migrationCache.Get() cachedMsgs := migrationCache.Get()
if len(cachedMsgs) == 0 { if len(cachedMsgs) == 0 {
p.pubLogger.Warnw("migration data cache timed out, no cached messages received", nil, "lastPubReliableSeq", p.params.LastPubReliableSeq) p.pubLogger.Warnw(
"migration data cache timed out, no cached messages received", nil,
"lastPubReliableSeq", p.params.LastPubReliableSeq,
)
} else { } else {
p.pubLogger.Warnw("migration data cache timed out, handling cached messages", nil, p.pubLogger.Warnw(
"migration data cache timed out, handling cached messages", nil,
"cachedFirstSeq", cachedMsgs[0].Sequence, "cachedFirstSeq", cachedMsgs[0].Sequence,
"cachedLastSeq", cachedMsgs[len(cachedMsgs)-1].Sequence, "cachedLastSeq", cachedMsgs[len(cachedMsgs)-1].Sequence,
"lastPubReliableSeq", p.params.LastPubReliableSeq, "lastPubReliableSeq", p.params.LastPubReliableSeq,
@@ -2316,7 +2410,11 @@ func (p *ParticipantImpl) onReceivedDataMessage(kind livekit.DataPacket_Kind, da
func (p *ParticipantImpl) handleReceivedDataMessage(kind livekit.DataPacket_Kind, dp *livekit.DataPacket) { func (p *ParticipantImpl) handleReceivedDataMessage(kind livekit.DataPacket_Kind, dp *livekit.DataPacket) {
if kind == livekit.DataPacket_RELIABLE && dp.Sequence > 0 { if kind == livekit.DataPacket_RELIABLE && dp.Sequence > 0 {
if p.reliableDataInfo.lastPubReliableSeq.Load() >= dp.Sequence { if p.reliableDataInfo.lastPubReliableSeq.Load() >= dp.Sequence {
p.params.Logger.Infow("received out of order reliable data packet", "lastPubReliableSeq", p.reliableDataInfo.lastPubReliableSeq.Load(), "dpSequence", dp.Sequence) p.params.Logger.Infow(
"received out of order reliable data packet",
"lastPubReliableSeq", p.reliableDataInfo.lastPubReliableSeq.Load(),
"dpSequence", dp.Sequence,
)
return return
} }
@@ -2694,6 +2792,12 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
track := p.GetPublishedTrack(livekit.TrackID(req.Sid)) track := p.GetPublishedTrack(livekit.TrackID(req.Sid))
if track == nil { if track == nil {
p.pubLogger.Infow("could not find existing track for multi-codec simulcast", "trackID", req.Sid) p.pubLogger.Infow("could not find existing track for multi-codec simulcast", "trackID", req.Sid)
p.sendRequestResponse(&livekit.RequestResponse{
Reason: livekit.RequestResponse_NOT_FOUND,
Request: &livekit.RequestResponse_AddTrack{
AddTrack: utils.CloneProto(req),
},
})
return nil return nil
} }
@@ -2873,6 +2977,12 @@ func (p *ParticipantImpl) addPendingTrackLocked(req *livekit.AddTrackRequest) *l
"request", logger.Proto(req), "request", logger.Proto(req),
"pendingTrack", p.pendingTracks[req.Cid], "pendingTrack", p.pendingTracks[req.Cid],
) )
p.sendRequestResponse(&livekit.RequestResponse{
Reason: livekit.RequestResponse_QUEUED,
Request: &livekit.RequestResponse_AddTrack{
AddTrack: utils.CloneProto(req),
},
})
return nil return nil
} }
@@ -2910,22 +3020,23 @@ func (p *ParticipantImpl) HasConnected() bool {
return p.TransportManager.HasSubscriberEverConnected() || p.TransportManager.HasPublisherEverConnected() return p.TransportManager.HasSubscriberEverConnected() || p.TransportManager.HasPublisherEverConnected()
} }
func (p *ParticipantImpl) SetTrackMuted(trackID livekit.TrackID, muted bool, fromAdmin bool) *livekit.TrackInfo { func (p *ParticipantImpl) SetTrackMuted(mute *livekit.MuteTrackRequest, fromAdmin bool) *livekit.TrackInfo {
// when request is coming from admin, send message to current participant // when request is coming from admin, send message to current participant
if fromAdmin { if fromAdmin {
p.sendTrackMuted(trackID, muted) p.sendTrackMuted(livekit.TrackID(mute.Sid), mute.Muted)
} }
return p.setTrackMuted(trackID, muted) return p.setTrackMuted(mute, fromAdmin)
} }
func (p *ParticipantImpl) setTrackMuted(trackID livekit.TrackID, muted bool) *livekit.TrackInfo { func (p *ParticipantImpl) setTrackMuted(mute *livekit.MuteTrackRequest, fromAdmin bool) *livekit.TrackInfo {
trackID := livekit.TrackID(mute.Sid)
p.dirty.Store(true) p.dirty.Store(true)
if p.supervisor != nil { if p.supervisor != nil {
p.supervisor.SetPublicationMute(trackID, muted) p.supervisor.SetPublicationMute(trackID, mute.Muted)
} }
track, changed := p.UpTrackManager.SetPublishedTrackMuted(trackID, muted) track, changed := p.UpTrackManager.SetPublishedTrackMuted(trackID, mute.Muted)
var trackInfo *livekit.TrackInfo var trackInfo *livekit.TrackInfo
if track != nil { if track != nil {
trackInfo = track.ToProto() trackInfo = track.ToProto()
@@ -2937,8 +3048,8 @@ func (p *ParticipantImpl) setTrackMuted(trackID livekit.TrackID, muted bool) *li
for i, ti := range pti.trackInfos { for i, ti := range pti.trackInfos {
if livekit.TrackID(ti.Sid) == trackID { if livekit.TrackID(ti.Sid) == trackID {
ti = utils.CloneProto(ti) ti = utils.CloneProto(ti)
changed = changed || ti.Muted != muted changed = changed || ti.Muted != mute.Muted
ti.Muted = muted ti.Muted = mute.Muted
pti.trackInfos[i] = ti pti.trackInfos[i] = ti
if trackInfo == nil { if trackInfo == nil {
trackInfo = ti trackInfo = ti
@@ -2949,13 +3060,22 @@ func (p *ParticipantImpl) setTrackMuted(trackID livekit.TrackID, muted bool) *li
p.pendingTracksLock.RUnlock() p.pendingTracksLock.RUnlock()
if trackInfo != nil && changed { if trackInfo != nil && changed {
if muted { if mute.Muted {
p.params.Telemetry.TrackMuted(context.Background(), p.ID(), trackInfo) p.params.Telemetry.TrackMuted(context.Background(), p.ID(), trackInfo)
} else { } else {
p.params.Telemetry.TrackUnmuted(context.Background(), p.ID(), trackInfo) p.params.Telemetry.TrackUnmuted(context.Background(), p.ID(), trackInfo)
} }
} }
if trackInfo == nil && !fromAdmin {
p.sendRequestResponse(&livekit.RequestResponse{
Reason: livekit.RequestResponse_NOT_FOUND,
Request: &livekit.RequestResponse_Mute{
Mute: utils.CloneProto(mute),
},
})
}
return trackInfo return trackInfo
} }
@@ -3602,7 +3722,7 @@ func (p *ParticipantImpl) GetPlayoutDelayConfig() *livekit.PlayoutDelay {
} }
func (p *ParticipantImpl) SupportsSyncStreamID() bool { func (p *ParticipantImpl) SupportsSyncStreamID() bool {
return p.ProtocolVersion().SupportSyncStreamID() && !p.params.ClientInfo.isFirefox() && p.params.SyncStreams return p.ProtocolVersion().SupportsSyncStreamID() && !p.params.ClientInfo.isFirefox() && p.params.SyncStreams
} }
func (p *ParticipantImpl) SupportsTransceiverReuse() bool { func (p *ParticipantImpl) SupportsTransceiverReuse() bool {
@@ -3779,6 +3899,12 @@ func (p *ParticipantImpl) UpdateAudioTrack(update *livekit.UpdateLocalAudioTrack
} }
p.pubLogger.Debugw("could not locate track", "trackID", update.TrackSid) p.pubLogger.Debugw("could not locate track", "trackID", update.TrackSid)
p.sendRequestResponse(&livekit.RequestResponse{
Reason: livekit.RequestResponse_NOT_FOUND,
Request: &livekit.RequestResponse_UpdateAudioTrack{
UpdateAudioTrack: utils.CloneProto(update),
},
})
return errors.New("could not find track") return errors.New("could not find track")
} }
@@ -3805,6 +3931,12 @@ func (p *ParticipantImpl) UpdateVideoTrack(update *livekit.UpdateLocalVideoTrack
} }
p.pubLogger.Debugw("could not locate track", "trackID", update.TrackSid) p.pubLogger.Debugw("could not locate track", "trackID", update.TrackSid)
p.sendRequestResponse(&livekit.RequestResponse{
Reason: livekit.RequestResponse_NOT_FOUND,
Request: &livekit.RequestResponse_UpdateVideoTrack{
UpdateVideoTrack: utils.CloneProto(update),
},
})
return errors.New("could not find track") return errors.New("could not find track")
} }
+31 -10
View File
@@ -132,7 +132,8 @@ func TestTrackPublishing(t *testing.T) {
Type: livekit.TrackType_AUDIO, Type: livekit.TrackType_AUDIO,
}) })
require.Equal(t, 1, sink.WriteMessageCallCount()) // error response on duplicate adds a message
require.Equal(t, 2, sink.WriteMessageCallCount())
}) })
t.Run("should queue adding of duplicate tracks if already published by client id in signalling", func(t *testing.T) { t.Run("should queue adding of duplicate tracks if already published by client id in signalling", func(t *testing.T) {
@@ -150,7 +151,8 @@ func TestTrackPublishing(t *testing.T) {
Name: "webcam", Name: "webcam",
Type: livekit.TrackType_VIDEO, Type: livekit.TrackType_VIDEO,
}) })
require.Equal(t, 0, sink.WriteMessageCallCount()) // `queued` `RequestResponse` should add a message
require.Equal(t, 1, sink.WriteMessageCallCount())
require.Equal(t, 1, len(p.pendingTracks["cid"].trackInfos)) require.Equal(t, 1, len(p.pendingTracks["cid"].trackInfos))
// add again - it should be added to the queue // add again - it should be added to the queue
@@ -159,7 +161,8 @@ func TestTrackPublishing(t *testing.T) {
Name: "webcam", Name: "webcam",
Type: livekit.TrackType_VIDEO, Type: livekit.TrackType_VIDEO,
}) })
require.Equal(t, 0, sink.WriteMessageCallCount()) // `queued` `RequestResponse`s should have been sent for duplicate additions
require.Equal(t, 2, sink.WriteMessageCallCount())
require.Equal(t, 2, len(p.pendingTracks["cid"].trackInfos)) require.Equal(t, 2, len(p.pendingTracks["cid"].trackInfos))
// check SID is the same // check SID is the same
@@ -181,7 +184,8 @@ func TestTrackPublishing(t *testing.T) {
Name: "webcam", Name: "webcam",
Type: livekit.TrackType_VIDEO, Type: livekit.TrackType_VIDEO,
}) })
require.Equal(t, 0, sink.WriteMessageCallCount()) // `queued` `RequestResponse` should add a message
require.Equal(t, 1, sink.WriteMessageCallCount())
require.Equal(t, 1, len(p.pendingTracks["cid"].trackInfos)) require.Equal(t, 1, len(p.pendingTracks["cid"].trackInfos))
// add again - it should be added to the queue // add again - it should be added to the queue
@@ -190,7 +194,8 @@ func TestTrackPublishing(t *testing.T) {
Name: "webcam", Name: "webcam",
Type: livekit.TrackType_VIDEO, Type: livekit.TrackType_VIDEO,
}) })
require.Equal(t, 0, sink.WriteMessageCallCount()) // `queued` `RequestResponse`s should have been sent for duplicate additions
require.Equal(t, 2, sink.WriteMessageCallCount())
require.Equal(t, 2, len(p.pendingTracks["cid"].trackInfos)) require.Equal(t, 2, len(p.pendingTracks["cid"].trackInfos))
// check SID is the same // check SID is the same
@@ -220,7 +225,8 @@ func TestTrackPublishing(t *testing.T) {
Type: livekit.TrackType_AUDIO, Type: livekit.TrackType_AUDIO,
Source: livekit.TrackSource_MICROPHONE, Source: livekit.TrackSource_MICROPHONE,
}) })
require.Equal(t, 1, sink.WriteMessageCallCount()) // an error response for disallowed source should send a `RequestResponse`.
require.Equal(t, 2, sink.WriteMessageCallCount())
}) })
} }
@@ -278,7 +284,10 @@ func TestMuteSetting(t *testing.T) {
ti := &livekit.TrackInfo{Sid: "testTrack"} ti := &livekit.TrackInfo{Sid: "testTrack"}
p.pendingTracks["cid"] = &pendingTrackInfo{trackInfos: []*livekit.TrackInfo{ti}} p.pendingTracks["cid"] = &pendingTrackInfo{trackInfos: []*livekit.TrackInfo{ti}}
p.SetTrackMuted(livekit.TrackID(ti.Sid), true, false) p.SetTrackMuted(&livekit.MuteTrackRequest{
Sid: ti.Sid,
Muted: true,
}, false)
require.True(t, p.pendingTracks["cid"].trackInfos[0].Muted) require.True(t, p.pendingTracks["cid"].trackInfos[0].Muted)
}) })
@@ -384,7 +393,11 @@ func TestDisableCodecs(t *testing.T) {
} }
return nil return nil
}) })
participant.HandleOffer(sdp, offerId) participant.HandleOffer(&livekit.SessionDescription{
Type: webrtc.SDPTypeOffer.String(),
Sdp: sdp.SDP,
Id: offerId,
})
testutils.WithTimeout(t, func() string { testutils.WithTimeout(t, func() string {
if answerReceived.Load() && answerIdReceived.Load() == offerId { if answerReceived.Load() && answerIdReceived.Load() == offerId {
@@ -573,7 +586,11 @@ func TestPreferMediaCodecForPublisher(t *testing.T) {
} }
return nil return nil
}) })
participant.HandleOffer(sdp, offerId) participant.HandleOffer(&livekit.SessionDescription{
Type: webrtc.SDPTypeOffer.String(),
Sdp: sdp.SDP,
Id: offerId,
})
require.Eventually(t, func() bool { return answerReceived.Load() && answerIdReceived.Load() == offerId }, 5*time.Second, 10*time.Millisecond) require.Eventually(t, func() bool { return answerReceived.Load() && answerIdReceived.Load() == offerId }, 5*time.Second, 10*time.Millisecond)
@@ -660,7 +677,11 @@ func TestPreferAudioCodecForRed(t *testing.T) {
} }
return nil return nil
}) })
participant.HandleOffer(sdp, offerId) participant.HandleOffer(&livekit.SessionDescription{
Type: webrtc.SDPTypeOffer.String(),
Sdp: sdp.SDP,
Id: offerId,
})
require.Eventually(t, func() bool { return answerReceived.Load() && answerIdReceived.Load() == offerId }, 5*time.Second, 10*time.Millisecond) require.Eventually(t, func() bool { return answerReceived.Load() && answerIdReceived.Load() == offerId }, 5*time.Second, 10*time.Millisecond)
+4 -4
View File
@@ -157,8 +157,8 @@ func (p *ParticipantImpl) SendRefreshToken(token string) error {
return p.signaller.WriteMessage(p.signalling.SignalRefreshToken(token)) return p.signaller.WriteMessage(p.signalling.SignalRefreshToken(token))
} }
func (p *ParticipantImpl) SendRequestResponse(requestResponse *livekit.RequestResponse) error { func (p *ParticipantImpl) sendRequestResponse(requestResponse *livekit.RequestResponse) error {
if requestResponse.RequestId == 0 || !p.params.ClientInfo.SupportErrorResponse() { if !p.params.ClientInfo.SupportsRequestResponse() {
return nil return nil
} }
@@ -183,7 +183,7 @@ func (p *ParticipantImpl) HandleReconnectAndSendResponse(reconnectReason livekit
return err return err
} }
if p.params.ProtocolVersion.SupportHandlesDisconnectedUpdate() { if p.params.ProtocolVersion.SupportsDisconnectedUpdate() {
return p.sendDisconnectUpdatesForReconnect() return p.sendDisconnectUpdatesForReconnect()
} }
@@ -248,7 +248,7 @@ func (p *ParticipantImpl) sendTrackUnpublished(trackID livekit.TrackID) {
} }
func (p *ParticipantImpl) sendTrackHasBeenSubscribed(trackID livekit.TrackID) { func (p *ParticipantImpl) sendTrackHasBeenSubscribed(trackID livekit.TrackID) {
if !p.params.ClientInfo.SupportTrackSubscribedEvent() { if !p.params.ClientInfo.SupportsTrackSubscribedEvent() {
return return
} }
_ = p.signaller.WriteMessage(p.signalling.SignalTrackSubscribed(&livekit.TrackSubscribed{ _ = p.signaller.WriteMessage(p.signalling.SignalTrackSubscribed(&livekit.TrackSubscribed{
+1 -1
View File
@@ -179,7 +179,7 @@ func TestParticipantUpdate(t *testing.T) {
"track mutes are sent to everyone", "track mutes are sent to everyone",
true, true,
func(p types.LocalParticipant) { func(p types.LocalParticipant) {
p.SetTrackMuted("", true, false) p.SetTrackMuted(&livekit.MuteTrackRequest{Muted: true}, false)
}, },
}, },
{ {
+1
View File
@@ -23,4 +23,5 @@ var (
ErrNameExceedsLimits = errors.New("name length exceeds limits") ErrNameExceedsLimits = errors.New("name length exceeds limits")
ErrMetadataExceedsLimits = errors.New("metadata size exceeds limits") ErrMetadataExceedsLimits = errors.New("metadata size exceeds limits")
ErrAttributesExceedsLimits = errors.New("attributes size exceeds limits") ErrAttributesExceedsLimits = errors.New("attributes size exceeds limits")
ErrUpdateOwnMetadataNotAllowed = errors.New("update own metadata not allowed")
) )
+5 -52
View File
@@ -19,7 +19,6 @@ import (
"github.com/livekit/protocol/livekit" "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger" "github.com/livekit/protocol/logger"
protosignalling "github.com/livekit/protocol/signalling"
"google.golang.org/protobuf/proto" "google.golang.org/protobuf/proto"
"github.com/livekit/livekit-server/pkg/rtc/types" "github.com/livekit/livekit-server/pkg/rtc/types"
@@ -58,24 +57,19 @@ func (s *signalhandler) HandleMessage(msg proto.Message) error {
s.params.Logger.Debugw("handling signal request", "request", logger.Proto(req)) s.params.Logger.Debugw("handling signal request", "request", logger.Proto(req))
switch msg := req.GetMessage().(type) { switch msg := req.GetMessage().(type) {
case *livekit.SignalRequest_Offer: case *livekit.SignalRequest_Offer:
s.params.Participant.HandleOffer(protosignalling.FromProtoSessionDescription(msg.Offer)) s.params.Participant.HandleOffer(msg.Offer)
case *livekit.SignalRequest_Answer: case *livekit.SignalRequest_Answer:
s.params.Participant.HandleAnswer(protosignalling.FromProtoSessionDescription(msg.Answer)) s.params.Participant.HandleAnswer(msg.Answer)
case *livekit.SignalRequest_Trickle: case *livekit.SignalRequest_Trickle:
candidateInit, err := protosignalling.FromProtoTrickle(msg.Trickle) s.params.Participant.HandleICETrickle(msg.Trickle)
if err != nil {
s.params.Logger.Warnw("could not decode trickle", err)
return err
}
s.params.Participant.AddICECandidate(candidateInit, msg.Trickle.Target)
case *livekit.SignalRequest_AddTrack: case *livekit.SignalRequest_AddTrack:
s.params.Participant.AddTrack(msg.AddTrack) s.params.Participant.AddTrack(msg.AddTrack)
case *livekit.SignalRequest_Mute: case *livekit.SignalRequest_Mute:
s.params.Participant.SetTrackMuted(livekit.TrackID(msg.Mute.Sid), msg.Mute.Muted, false) s.params.Participant.SetTrackMuted(msg.Mute, false)
case *livekit.SignalRequest_Subscription: case *livekit.SignalRequest_Subscription:
// allow participant to indicate their interest in the subscription // allow participant to indicate their interest in the subscription
@@ -137,48 +131,7 @@ func (s *signalhandler) HandleMessage(msg proto.Message) error {
} }
case *livekit.SignalRequest_UpdateMetadata: case *livekit.SignalRequest_UpdateMetadata:
requestResponse := &livekit.RequestResponse{ s.params.Participant.UpdateMetadata(msg.UpdateMetadata, false)
RequestId: msg.UpdateMetadata.RequestId,
Reason: livekit.RequestResponse_OK,
}
if s.params.Participant.ClaimGrants().Video.GetCanUpdateOwnMetadata() {
if err := s.params.Participant.CheckMetadataLimits(
msg.UpdateMetadata.Name,
msg.UpdateMetadata.Metadata,
msg.UpdateMetadata.Attributes,
); err == nil {
if msg.UpdateMetadata.Name != "" {
s.params.Participant.SetName(msg.UpdateMetadata.Name)
}
if msg.UpdateMetadata.Metadata != "" {
s.params.Participant.SetMetadata(msg.UpdateMetadata.Metadata)
}
if msg.UpdateMetadata.Attributes != nil {
s.params.Participant.SetAttributes(msg.UpdateMetadata.Attributes)
}
} else {
s.params.Logger.Warnw("could not update metadata", err)
switch err {
case ErrNameExceedsLimits:
requestResponse.Reason = livekit.RequestResponse_LIMIT_EXCEEDED
requestResponse.Message = "exceeds name length limit"
case ErrMetadataExceedsLimits:
requestResponse.Reason = livekit.RequestResponse_LIMIT_EXCEEDED
requestResponse.Message = "exceeds metadata size limit"
case ErrAttributesExceedsLimits:
requestResponse.Reason = livekit.RequestResponse_LIMIT_EXCEEDED
requestResponse.Message = "exceeds attributes size limit"
}
}
} else {
requestResponse.Reason = livekit.RequestResponse_NOT_ALLOWED
requestResponse.Message = "does not have permission to update own metadata"
}
s.params.Participant.SendRequestResponse(requestResponse)
case *livekit.SignalRequest_UpdateAudioTrack: case *livekit.SignalRequest_UpdateAudioTrack:
if err := s.params.Participant.UpdateAudioTrack(msg.UpdateAudioTrack); err != nil { if err := s.params.Participant.UpdateAudioTrack(msg.UpdateAudioTrack); err != nil {
+1 -1
View File
@@ -68,7 +68,7 @@ func NewMockParticipant(identity livekit.ParticipantIdentity, protocol types.Pro
} }
} }
p.SetTrackMutedCalls(func(sid livekit.TrackID, muted bool, fromServer bool) *livekit.TrackInfo { p.SetTrackMutedCalls(func(mute *livekit.MuteTrackRequest, fromServer bool) *livekit.TrackInfo {
updateTrack() updateTrack()
return nil return nil
}) })
+9 -5
View File
@@ -329,7 +329,7 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
se.SetFireOnTrackBeforeFirstRTP(true) se.SetFireOnTrackBeforeFirstRTP(true)
} }
if params.ClientInfo.SupportSctpZeroChecksum() { if params.ClientInfo.SupportsSctpZeroChecksum() {
se.EnableSCTPZeroChecksum(true) se.EnableSCTPZeroChecksum(true)
} }
@@ -352,7 +352,7 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
// //
se.DisableSRTPReplayProtection(true) se.DisableSRTPReplayProtection(true)
se.DisableSRTCPReplayProtection(true) se.DisableSRTCPReplayProtection(true)
if !params.ProtocolVersion.SupportsICELite() || !params.ClientInfo.SupportPrflxOverRelay() { if !params.ProtocolVersion.SupportsICELite() || !params.ClientInfo.SupportsPrflxOverRelay() {
// if client don't support prflx over relay which is only Firefox, disable ICE Lite to ensure that // if client don't support prflx over relay which is only Firefox, disable ICE Lite to ensure that
// aggressive nomination is handled properly. Firefox does aggressive nomination even if peer is // aggressive nomination is handled properly. Firefox does aggressive nomination even if peer is
// ICE Lite (see comment as to historical reasons: https://github.com/pion/ice/pull/739#issuecomment-2452245066). // ICE Lite (see comment as to historical reasons: https://github.com/pion/ice/pull/739#issuecomment-2452245066).
@@ -366,7 +366,7 @@ func newPeerConnection(params TransportParams, onBandwidthEstimator func(estimat
se.SetICETimeouts(iceDisconnectedTimeout, iceFailedTimeout, iceKeepaliveInterval) se.SetICETimeouts(iceDisconnectedTimeout, iceFailedTimeout, iceKeepaliveInterval)
// if client don't support prflx over relay, we should not expose private address to it, use single external ip as host candidate // if client don't support prflx over relay, we should not expose private address to it, use single external ip as host candidate
if !params.ClientInfo.SupportPrflxOverRelay() && len(params.Config.NAT1To1IPs) > 0 { if !params.ClientInfo.SupportsPrflxOverRelay() && len(params.Config.NAT1To1IPs) > 0 {
var nat1to1Ips []string var nat1to1Ips []string
var includeIps []string var includeIps []string
for _, mapping := range params.Config.NAT1To1IPs { for _, mapping := range params.Config.NAT1To1IPs {
@@ -2600,7 +2600,7 @@ func (t *PCTransport) handleRemoteOfferReceived(sd *webrtc.SessionDescription, o
parsed, err := sd.Unmarshal() parsed, err := sd.Unmarshal()
if err != nil { if err != nil {
return nil return err
} }
t.lock.Lock() t.lock.Lock()
@@ -2661,7 +2661,11 @@ func (t *PCTransport) handleRemoteOfferReceived(sd *webrtc.SessionDescription, o
func (t *PCTransport) handleRemoteAnswerReceived(sd *webrtc.SessionDescription, answerId uint32) error { func (t *PCTransport) handleRemoteAnswerReceived(sd *webrtc.SessionDescription, answerId uint32) error {
t.params.Logger.Debugw("processing answer", "answerId", answerId) t.params.Logger.Debugw("processing answer", "answerId", answerId)
if answerId != 0 && answerId != t.localOfferId.Load() { if answerId != 0 && answerId != t.localOfferId.Load() {
t.params.Logger.Warnw("sdp state: answer id mismatch", nil, "expected", t.localOfferId.Load(), "got", answerId) t.params.Logger.Warnw(
"sdp state: answer id mismatch", nil,
"expected", t.localOfferId.Load(),
"got", answerId,
)
} }
t.remoteAnswerId.Store(answerId) t.remoteAnswerId.Store(answerId)
+6 -6
View File
@@ -387,7 +387,7 @@ type LocalParticipant interface {
HandleSignalSourceClose() HandleSignalSourceClose()
// updates // updates
CheckMetadataLimits(name string, metadata string, attributes map[string]string) error UpdateMetadata(update *livekit.UpdateParticipantMetadata, fromAdmin bool) error
SetName(name string) SetName(name string)
SetMetadata(metadata string) SetMetadata(metadata string)
SetAttributes(attributes map[string]string) SetAttributes(attributes map[string]string)
@@ -403,15 +403,15 @@ type LocalParticipant interface {
CanPublishData() bool CanPublishData() bool
// PeerConnection // PeerConnection
AddICECandidate(candidate webrtc.ICECandidateInit, target livekit.SignalTarget) HandleICETrickle(trickleRequest *livekit.TrickleRequest)
HandleOffer(sdp webrtc.SessionDescription, offerId uint32) error HandleOffer(sd *livekit.SessionDescription) error
GetAnswer() (webrtc.SessionDescription, uint32, error) GetAnswer() (webrtc.SessionDescription, uint32, error)
HandleICETrickleSDPFragment(sdpFragment string) error HandleICETrickleSDPFragment(sdpFragment string) error
HandleICERestartSDPFragment(sdpFragment string) (string, error) HandleICERestartSDPFragment(sdpFragment string) (string, error)
AddTrack(req *livekit.AddTrackRequest) AddTrack(req *livekit.AddTrackRequest)
SetTrackMuted(trackID livekit.TrackID, muted bool, fromAdmin bool) *livekit.TrackInfo SetTrackMuted(mute *livekit.MuteTrackRequest, fromAdmin bool) *livekit.TrackInfo
HandleAnswer(sdp webrtc.SessionDescription, answerId uint32) HandleAnswer(sd *livekit.SessionDescription)
Negotiate(force bool) Negotiate(force bool)
ICERestart(iceConfig *livekit.ICEConfig) ICERestart(iceConfig *livekit.ICEConfig)
AddTrackLocal(trackLocal webrtc.TrackLocal, params AddTrackParams) (*webrtc.RTPSender, *webrtc.RTPTransceiver, error) AddTrackLocal(trackLocal webrtc.TrackLocal, params AddTrackParams) (*webrtc.RTPSender, *webrtc.RTPTransceiver, error)
@@ -450,7 +450,7 @@ type LocalParticipant interface {
SendConnectionQualityUpdate(update *livekit.ConnectionQualityUpdate) error SendConnectionQualityUpdate(update *livekit.ConnectionQualityUpdate) error
SendSubscriptionPermissionUpdate(publisherID livekit.ParticipantID, trackID livekit.TrackID, allowed bool) error SendSubscriptionPermissionUpdate(publisherID livekit.ParticipantID, trackID livekit.TrackID, allowed bool) error
SendRefreshToken(token string) error SendRefreshToken(token string) error
SendRequestResponse(requestResponse *livekit.RequestResponse) error // RAJA-REMOVE SendRequestResponse(requestResponse *livekit.RequestResponse) error
HandleReconnectAndSendResponse(reconnectReason livekit.ReconnectReason, reconnectResponse *livekit.ReconnectResponse) error HandleReconnectAndSendResponse(reconnectReason livekit.ReconnectReason, reconnectResponse *livekit.ReconnectResponse) error
IssueFullReconnect(reason ParticipantCloseReason) IssueFullReconnect(reason ParticipantCloseReason)
SendRoomMovedResponse(moved *livekit.RoomMovedResponse) error SendRoomMovedResponse(moved *livekit.RoomMovedResponse) error
+2 -2
View File
@@ -68,11 +68,11 @@ func (v ProtocolVersion) SupportFastStart() bool {
return v > 7 return v > 7
} }
func (v ProtocolVersion) SupportHandlesDisconnectedUpdate() bool { func (v ProtocolVersion) SupportsDisconnectedUpdate() bool {
return v > 8 return v > 8
} }
func (v ProtocolVersion) SupportSyncStreamID() bool { func (v ProtocolVersion) SupportsSyncStreamID() bool {
return v > 9 return v > 9
} }
+141 -223
View File
@@ -21,12 +21,6 @@ import (
) )
type FakeLocalParticipant struct { type FakeLocalParticipant struct {
AddICECandidateStub func(webrtc.ICECandidateInit, livekit.SignalTarget)
addICECandidateMutex sync.RWMutex
addICECandidateArgsForCall []struct {
arg1 webrtc.ICECandidateInit
arg2 livekit.SignalTarget
}
AddTrackStub func(*livekit.AddTrackRequest) AddTrackStub func(*livekit.AddTrackRequest)
addTrackMutex sync.RWMutex addTrackMutex sync.RWMutex
addTrackArgsForCall []struct { addTrackArgsForCall []struct {
@@ -122,19 +116,6 @@ type FakeLocalParticipant struct {
canSubscribeReturnsOnCall map[int]struct { canSubscribeReturnsOnCall map[int]struct {
result1 bool result1 bool
} }
CheckMetadataLimitsStub func(string, string, map[string]string) error
checkMetadataLimitsMutex sync.RWMutex
checkMetadataLimitsArgsForCall []struct {
arg1 string
arg2 string
arg3 map[string]string
}
checkMetadataLimitsReturns struct {
result1 error
}
checkMetadataLimitsReturnsOnCall map[int]struct {
result1 error
}
ClaimGrantsStub func() *auth.ClaimGrants ClaimGrantsStub func() *auth.ClaimGrants
claimGrantsMutex sync.RWMutex claimGrantsMutex sync.RWMutex
claimGrantsArgsForCall []struct { claimGrantsArgsForCall []struct {
@@ -497,11 +478,10 @@ type FakeLocalParticipant struct {
getTrailerReturnsOnCall map[int]struct { getTrailerReturnsOnCall map[int]struct {
result1 []byte result1 []byte
} }
HandleAnswerStub func(webrtc.SessionDescription, uint32) HandleAnswerStub func(*livekit.SessionDescription)
handleAnswerMutex sync.RWMutex handleAnswerMutex sync.RWMutex
handleAnswerArgsForCall []struct { handleAnswerArgsForCall []struct {
arg1 webrtc.SessionDescription arg1 *livekit.SessionDescription
arg2 uint32
} }
HandleICERestartSDPFragmentStub func(string) (string, error) HandleICERestartSDPFragmentStub func(string) (string, error)
handleICERestartSDPFragmentMutex sync.RWMutex handleICERestartSDPFragmentMutex sync.RWMutex
@@ -516,6 +496,11 @@ type FakeLocalParticipant struct {
result1 string result1 string
result2 error result2 error
} }
HandleICETrickleStub func(*livekit.TrickleRequest)
handleICETrickleMutex sync.RWMutex
handleICETrickleArgsForCall []struct {
arg1 *livekit.TrickleRequest
}
HandleICETrickleSDPFragmentStub func(string) error HandleICETrickleSDPFragmentStub func(string) error
handleICETrickleSDPFragmentMutex sync.RWMutex handleICETrickleSDPFragmentMutex sync.RWMutex
handleICETrickleSDPFragmentArgsForCall []struct { handleICETrickleSDPFragmentArgsForCall []struct {
@@ -544,11 +529,10 @@ type FakeLocalParticipant struct {
handleMetricsReturnsOnCall map[int]struct { handleMetricsReturnsOnCall map[int]struct {
result1 error result1 error
} }
HandleOfferStub func(webrtc.SessionDescription, uint32) error HandleOfferStub func(*livekit.SessionDescription) error
handleOfferMutex sync.RWMutex handleOfferMutex sync.RWMutex
handleOfferArgsForCall []struct { handleOfferArgsForCall []struct {
arg1 webrtc.SessionDescription arg1 *livekit.SessionDescription
arg2 uint32
} }
handleOfferReturns struct { handleOfferReturns struct {
result1 error result1 error
@@ -1053,17 +1037,6 @@ type FakeLocalParticipant struct {
sendRefreshTokenReturnsOnCall map[int]struct { sendRefreshTokenReturnsOnCall map[int]struct {
result1 error result1 error
} }
SendRequestResponseStub func(*livekit.RequestResponse) error
sendRequestResponseMutex sync.RWMutex
sendRequestResponseArgsForCall []struct {
arg1 *livekit.RequestResponse
}
sendRequestResponseReturns struct {
result1 error
}
sendRequestResponseReturnsOnCall map[int]struct {
result1 error
}
SendRoomMovedResponseStub func(*livekit.RoomMovedResponse) error SendRoomMovedResponseStub func(*livekit.RoomMovedResponse) error
sendRoomMovedResponseMutex sync.RWMutex sendRoomMovedResponseMutex sync.RWMutex
sendRoomMovedResponseArgsForCall []struct { sendRoomMovedResponseArgsForCall []struct {
@@ -1176,12 +1149,11 @@ type FakeLocalParticipant struct {
setSubscriberChannelCapacityArgsForCall []struct { setSubscriberChannelCapacityArgsForCall []struct {
arg1 int64 arg1 int64
} }
SetTrackMutedStub func(livekit.TrackID, bool, bool) *livekit.TrackInfo SetTrackMutedStub func(*livekit.MuteTrackRequest, bool) *livekit.TrackInfo
setTrackMutedMutex sync.RWMutex setTrackMutedMutex sync.RWMutex
setTrackMutedArgsForCall []struct { setTrackMutedArgsForCall []struct {
arg1 livekit.TrackID arg1 *livekit.MuteTrackRequest
arg2 bool arg2 bool
arg3 bool
} }
setTrackMutedReturns struct { setTrackMutedReturns struct {
result1 *livekit.TrackInfo result1 *livekit.TrackInfo
@@ -1342,6 +1314,18 @@ type FakeLocalParticipant struct {
updateMediaRTTArgsForCall []struct { updateMediaRTTArgsForCall []struct {
arg1 uint32 arg1 uint32
} }
UpdateMetadataStub func(*livekit.UpdateParticipantMetadata, bool) error
updateMetadataMutex sync.RWMutex
updateMetadataArgsForCall []struct {
arg1 *livekit.UpdateParticipantMetadata
arg2 bool
}
updateMetadataReturns struct {
result1 error
}
updateMetadataReturnsOnCall map[int]struct {
result1 error
}
UpdateSignalingRTTStub func(uint32) UpdateSignalingRTTStub func(uint32)
updateSignalingRTTMutex sync.RWMutex updateSignalingRTTMutex sync.RWMutex
updateSignalingRTTArgsForCall []struct { updateSignalingRTTArgsForCall []struct {
@@ -1442,39 +1426,6 @@ type FakeLocalParticipant struct {
invocationsMutex sync.RWMutex invocationsMutex sync.RWMutex
} }
func (fake *FakeLocalParticipant) AddICECandidate(arg1 webrtc.ICECandidateInit, arg2 livekit.SignalTarget) {
fake.addICECandidateMutex.Lock()
fake.addICECandidateArgsForCall = append(fake.addICECandidateArgsForCall, struct {
arg1 webrtc.ICECandidateInit
arg2 livekit.SignalTarget
}{arg1, arg2})
stub := fake.AddICECandidateStub
fake.recordInvocation("AddICECandidate", []interface{}{arg1, arg2})
fake.addICECandidateMutex.Unlock()
if stub != nil {
fake.AddICECandidateStub(arg1, arg2)
}
}
func (fake *FakeLocalParticipant) AddICECandidateCallCount() int {
fake.addICECandidateMutex.RLock()
defer fake.addICECandidateMutex.RUnlock()
return len(fake.addICECandidateArgsForCall)
}
func (fake *FakeLocalParticipant) AddICECandidateCalls(stub func(webrtc.ICECandidateInit, livekit.SignalTarget)) {
fake.addICECandidateMutex.Lock()
defer fake.addICECandidateMutex.Unlock()
fake.AddICECandidateStub = stub
}
func (fake *FakeLocalParticipant) AddICECandidateArgsForCall(i int) (webrtc.ICECandidateInit, livekit.SignalTarget) {
fake.addICECandidateMutex.RLock()
defer fake.addICECandidateMutex.RUnlock()
argsForCall := fake.addICECandidateArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeLocalParticipant) AddTrack(arg1 *livekit.AddTrackRequest) { func (fake *FakeLocalParticipant) AddTrack(arg1 *livekit.AddTrackRequest) {
fake.addTrackMutex.Lock() fake.addTrackMutex.Lock()
fake.addTrackArgsForCall = append(fake.addTrackArgsForCall, struct { fake.addTrackArgsForCall = append(fake.addTrackArgsForCall, struct {
@@ -1950,69 +1901,6 @@ func (fake *FakeLocalParticipant) CanSubscribeReturnsOnCall(i int, result1 bool)
}{result1} }{result1}
} }
func (fake *FakeLocalParticipant) CheckMetadataLimits(arg1 string, arg2 string, arg3 map[string]string) error {
fake.checkMetadataLimitsMutex.Lock()
ret, specificReturn := fake.checkMetadataLimitsReturnsOnCall[len(fake.checkMetadataLimitsArgsForCall)]
fake.checkMetadataLimitsArgsForCall = append(fake.checkMetadataLimitsArgsForCall, struct {
arg1 string
arg2 string
arg3 map[string]string
}{arg1, arg2, arg3})
stub := fake.CheckMetadataLimitsStub
fakeReturns := fake.checkMetadataLimitsReturns
fake.recordInvocation("CheckMetadataLimits", []interface{}{arg1, arg2, arg3})
fake.checkMetadataLimitsMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeLocalParticipant) CheckMetadataLimitsCallCount() int {
fake.checkMetadataLimitsMutex.RLock()
defer fake.checkMetadataLimitsMutex.RUnlock()
return len(fake.checkMetadataLimitsArgsForCall)
}
func (fake *FakeLocalParticipant) CheckMetadataLimitsCalls(stub func(string, string, map[string]string) error) {
fake.checkMetadataLimitsMutex.Lock()
defer fake.checkMetadataLimitsMutex.Unlock()
fake.CheckMetadataLimitsStub = stub
}
func (fake *FakeLocalParticipant) CheckMetadataLimitsArgsForCall(i int) (string, string, map[string]string) {
fake.checkMetadataLimitsMutex.RLock()
defer fake.checkMetadataLimitsMutex.RUnlock()
argsForCall := fake.checkMetadataLimitsArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *FakeLocalParticipant) CheckMetadataLimitsReturns(result1 error) {
fake.checkMetadataLimitsMutex.Lock()
defer fake.checkMetadataLimitsMutex.Unlock()
fake.CheckMetadataLimitsStub = nil
fake.checkMetadataLimitsReturns = struct {
result1 error
}{result1}
}
func (fake *FakeLocalParticipant) CheckMetadataLimitsReturnsOnCall(i int, result1 error) {
fake.checkMetadataLimitsMutex.Lock()
defer fake.checkMetadataLimitsMutex.Unlock()
fake.CheckMetadataLimitsStub = nil
if fake.checkMetadataLimitsReturnsOnCall == nil {
fake.checkMetadataLimitsReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.checkMetadataLimitsReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeLocalParticipant) ClaimGrants() *auth.ClaimGrants { func (fake *FakeLocalParticipant) ClaimGrants() *auth.ClaimGrants {
fake.claimGrantsMutex.Lock() fake.claimGrantsMutex.Lock()
ret, specificReturn := fake.claimGrantsReturnsOnCall[len(fake.claimGrantsArgsForCall)] ret, specificReturn := fake.claimGrantsReturnsOnCall[len(fake.claimGrantsArgsForCall)]
@@ -3904,17 +3792,16 @@ func (fake *FakeLocalParticipant) GetTrailerReturnsOnCall(i int, result1 []byte)
}{result1} }{result1}
} }
func (fake *FakeLocalParticipant) HandleAnswer(arg1 webrtc.SessionDescription, arg2 uint32) { func (fake *FakeLocalParticipant) HandleAnswer(arg1 *livekit.SessionDescription) {
fake.handleAnswerMutex.Lock() fake.handleAnswerMutex.Lock()
fake.handleAnswerArgsForCall = append(fake.handleAnswerArgsForCall, struct { fake.handleAnswerArgsForCall = append(fake.handleAnswerArgsForCall, struct {
arg1 webrtc.SessionDescription arg1 *livekit.SessionDescription
arg2 uint32 }{arg1})
}{arg1, arg2})
stub := fake.HandleAnswerStub stub := fake.HandleAnswerStub
fake.recordInvocation("HandleAnswer", []interface{}{arg1, arg2}) fake.recordInvocation("HandleAnswer", []interface{}{arg1})
fake.handleAnswerMutex.Unlock() fake.handleAnswerMutex.Unlock()
if stub != nil { if stub != nil {
fake.HandleAnswerStub(arg1, arg2) fake.HandleAnswerStub(arg1)
} }
} }
@@ -3924,17 +3811,17 @@ func (fake *FakeLocalParticipant) HandleAnswerCallCount() int {
return len(fake.handleAnswerArgsForCall) return len(fake.handleAnswerArgsForCall)
} }
func (fake *FakeLocalParticipant) HandleAnswerCalls(stub func(webrtc.SessionDescription, uint32)) { func (fake *FakeLocalParticipant) HandleAnswerCalls(stub func(*livekit.SessionDescription)) {
fake.handleAnswerMutex.Lock() fake.handleAnswerMutex.Lock()
defer fake.handleAnswerMutex.Unlock() defer fake.handleAnswerMutex.Unlock()
fake.HandleAnswerStub = stub fake.HandleAnswerStub = stub
} }
func (fake *FakeLocalParticipant) HandleAnswerArgsForCall(i int) (webrtc.SessionDescription, uint32) { func (fake *FakeLocalParticipant) HandleAnswerArgsForCall(i int) *livekit.SessionDescription {
fake.handleAnswerMutex.RLock() fake.handleAnswerMutex.RLock()
defer fake.handleAnswerMutex.RUnlock() defer fake.handleAnswerMutex.RUnlock()
argsForCall := fake.handleAnswerArgsForCall[i] argsForCall := fake.handleAnswerArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2 return argsForCall.arg1
} }
func (fake *FakeLocalParticipant) HandleICERestartSDPFragment(arg1 string) (string, error) { func (fake *FakeLocalParticipant) HandleICERestartSDPFragment(arg1 string) (string, error) {
@@ -4001,6 +3888,38 @@ func (fake *FakeLocalParticipant) HandleICERestartSDPFragmentReturnsOnCall(i int
}{result1, result2} }{result1, result2}
} }
func (fake *FakeLocalParticipant) HandleICETrickle(arg1 *livekit.TrickleRequest) {
fake.handleICETrickleMutex.Lock()
fake.handleICETrickleArgsForCall = append(fake.handleICETrickleArgsForCall, struct {
arg1 *livekit.TrickleRequest
}{arg1})
stub := fake.HandleICETrickleStub
fake.recordInvocation("HandleICETrickle", []interface{}{arg1})
fake.handleICETrickleMutex.Unlock()
if stub != nil {
fake.HandleICETrickleStub(arg1)
}
}
func (fake *FakeLocalParticipant) HandleICETrickleCallCount() int {
fake.handleICETrickleMutex.RLock()
defer fake.handleICETrickleMutex.RUnlock()
return len(fake.handleICETrickleArgsForCall)
}
func (fake *FakeLocalParticipant) HandleICETrickleCalls(stub func(*livekit.TrickleRequest)) {
fake.handleICETrickleMutex.Lock()
defer fake.handleICETrickleMutex.Unlock()
fake.HandleICETrickleStub = stub
}
func (fake *FakeLocalParticipant) HandleICETrickleArgsForCall(i int) *livekit.TrickleRequest {
fake.handleICETrickleMutex.RLock()
defer fake.handleICETrickleMutex.RUnlock()
argsForCall := fake.handleICETrickleArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeLocalParticipant) HandleICETrickleSDPFragment(arg1 string) error { func (fake *FakeLocalParticipant) HandleICETrickleSDPFragment(arg1 string) error {
fake.handleICETrickleSDPFragmentMutex.Lock() fake.handleICETrickleSDPFragmentMutex.Lock()
ret, specificReturn := fake.handleICETrickleSDPFragmentReturnsOnCall[len(fake.handleICETrickleSDPFragmentArgsForCall)] ret, specificReturn := fake.handleICETrickleSDPFragmentReturnsOnCall[len(fake.handleICETrickleSDPFragmentArgsForCall)]
@@ -4156,19 +4075,18 @@ func (fake *FakeLocalParticipant) HandleMetricsReturnsOnCall(i int, result1 erro
}{result1} }{result1}
} }
func (fake *FakeLocalParticipant) HandleOffer(arg1 webrtc.SessionDescription, arg2 uint32) error { func (fake *FakeLocalParticipant) HandleOffer(arg1 *livekit.SessionDescription) error {
fake.handleOfferMutex.Lock() fake.handleOfferMutex.Lock()
ret, specificReturn := fake.handleOfferReturnsOnCall[len(fake.handleOfferArgsForCall)] ret, specificReturn := fake.handleOfferReturnsOnCall[len(fake.handleOfferArgsForCall)]
fake.handleOfferArgsForCall = append(fake.handleOfferArgsForCall, struct { fake.handleOfferArgsForCall = append(fake.handleOfferArgsForCall, struct {
arg1 webrtc.SessionDescription arg1 *livekit.SessionDescription
arg2 uint32 }{arg1})
}{arg1, arg2})
stub := fake.HandleOfferStub stub := fake.HandleOfferStub
fakeReturns := fake.handleOfferReturns fakeReturns := fake.handleOfferReturns
fake.recordInvocation("HandleOffer", []interface{}{arg1, arg2}) fake.recordInvocation("HandleOffer", []interface{}{arg1})
fake.handleOfferMutex.Unlock() fake.handleOfferMutex.Unlock()
if stub != nil { if stub != nil {
return stub(arg1, arg2) return stub(arg1)
} }
if specificReturn { if specificReturn {
return ret.result1 return ret.result1
@@ -4182,17 +4100,17 @@ func (fake *FakeLocalParticipant) HandleOfferCallCount() int {
return len(fake.handleOfferArgsForCall) return len(fake.handleOfferArgsForCall)
} }
func (fake *FakeLocalParticipant) HandleOfferCalls(stub func(webrtc.SessionDescription, uint32) error) { func (fake *FakeLocalParticipant) HandleOfferCalls(stub func(*livekit.SessionDescription) error) {
fake.handleOfferMutex.Lock() fake.handleOfferMutex.Lock()
defer fake.handleOfferMutex.Unlock() defer fake.handleOfferMutex.Unlock()
fake.HandleOfferStub = stub fake.HandleOfferStub = stub
} }
func (fake *FakeLocalParticipant) HandleOfferArgsForCall(i int) (webrtc.SessionDescription, uint32) { func (fake *FakeLocalParticipant) HandleOfferArgsForCall(i int) *livekit.SessionDescription {
fake.handleOfferMutex.RLock() fake.handleOfferMutex.RLock()
defer fake.handleOfferMutex.RUnlock() defer fake.handleOfferMutex.RUnlock()
argsForCall := fake.handleOfferArgsForCall[i] argsForCall := fake.handleOfferArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2 return argsForCall.arg1
} }
func (fake *FakeLocalParticipant) HandleOfferReturns(result1 error) { func (fake *FakeLocalParticipant) HandleOfferReturns(result1 error) {
@@ -7013,67 +6931,6 @@ func (fake *FakeLocalParticipant) SendRefreshTokenReturnsOnCall(i int, result1 e
}{result1} }{result1}
} }
func (fake *FakeLocalParticipant) SendRequestResponse(arg1 *livekit.RequestResponse) error {
fake.sendRequestResponseMutex.Lock()
ret, specificReturn := fake.sendRequestResponseReturnsOnCall[len(fake.sendRequestResponseArgsForCall)]
fake.sendRequestResponseArgsForCall = append(fake.sendRequestResponseArgsForCall, struct {
arg1 *livekit.RequestResponse
}{arg1})
stub := fake.SendRequestResponseStub
fakeReturns := fake.sendRequestResponseReturns
fake.recordInvocation("SendRequestResponse", []interface{}{arg1})
fake.sendRequestResponseMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeLocalParticipant) SendRequestResponseCallCount() int {
fake.sendRequestResponseMutex.RLock()
defer fake.sendRequestResponseMutex.RUnlock()
return len(fake.sendRequestResponseArgsForCall)
}
func (fake *FakeLocalParticipant) SendRequestResponseCalls(stub func(*livekit.RequestResponse) error) {
fake.sendRequestResponseMutex.Lock()
defer fake.sendRequestResponseMutex.Unlock()
fake.SendRequestResponseStub = stub
}
func (fake *FakeLocalParticipant) SendRequestResponseArgsForCall(i int) *livekit.RequestResponse {
fake.sendRequestResponseMutex.RLock()
defer fake.sendRequestResponseMutex.RUnlock()
argsForCall := fake.sendRequestResponseArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeLocalParticipant) SendRequestResponseReturns(result1 error) {
fake.sendRequestResponseMutex.Lock()
defer fake.sendRequestResponseMutex.Unlock()
fake.SendRequestResponseStub = nil
fake.sendRequestResponseReturns = struct {
result1 error
}{result1}
}
func (fake *FakeLocalParticipant) SendRequestResponseReturnsOnCall(i int, result1 error) {
fake.sendRequestResponseMutex.Lock()
defer fake.sendRequestResponseMutex.Unlock()
fake.SendRequestResponseStub = nil
if fake.sendRequestResponseReturnsOnCall == nil {
fake.sendRequestResponseReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.sendRequestResponseReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeLocalParticipant) SendRoomMovedResponse(arg1 *livekit.RoomMovedResponse) error { func (fake *FakeLocalParticipant) SendRoomMovedResponse(arg1 *livekit.RoomMovedResponse) error {
fake.sendRoomMovedResponseMutex.Lock() fake.sendRoomMovedResponseMutex.Lock()
ret, specificReturn := fake.sendRoomMovedResponseReturnsOnCall[len(fake.sendRoomMovedResponseArgsForCall)] ret, specificReturn := fake.sendRoomMovedResponseReturnsOnCall[len(fake.sendRoomMovedResponseArgsForCall)]
@@ -7726,20 +7583,19 @@ func (fake *FakeLocalParticipant) SetSubscriberChannelCapacityArgsForCall(i int)
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeLocalParticipant) SetTrackMuted(arg1 livekit.TrackID, arg2 bool, arg3 bool) *livekit.TrackInfo { func (fake *FakeLocalParticipant) SetTrackMuted(arg1 *livekit.MuteTrackRequest, arg2 bool) *livekit.TrackInfo {
fake.setTrackMutedMutex.Lock() fake.setTrackMutedMutex.Lock()
ret, specificReturn := fake.setTrackMutedReturnsOnCall[len(fake.setTrackMutedArgsForCall)] ret, specificReturn := fake.setTrackMutedReturnsOnCall[len(fake.setTrackMutedArgsForCall)]
fake.setTrackMutedArgsForCall = append(fake.setTrackMutedArgsForCall, struct { fake.setTrackMutedArgsForCall = append(fake.setTrackMutedArgsForCall, struct {
arg1 livekit.TrackID arg1 *livekit.MuteTrackRequest
arg2 bool arg2 bool
arg3 bool }{arg1, arg2})
}{arg1, arg2, arg3})
stub := fake.SetTrackMutedStub stub := fake.SetTrackMutedStub
fakeReturns := fake.setTrackMutedReturns fakeReturns := fake.setTrackMutedReturns
fake.recordInvocation("SetTrackMuted", []interface{}{arg1, arg2, arg3}) fake.recordInvocation("SetTrackMuted", []interface{}{arg1, arg2})
fake.setTrackMutedMutex.Unlock() fake.setTrackMutedMutex.Unlock()
if stub != nil { if stub != nil {
return stub(arg1, arg2, arg3) return stub(arg1, arg2)
} }
if specificReturn { if specificReturn {
return ret.result1 return ret.result1
@@ -7753,17 +7609,17 @@ func (fake *FakeLocalParticipant) SetTrackMutedCallCount() int {
return len(fake.setTrackMutedArgsForCall) return len(fake.setTrackMutedArgsForCall)
} }
func (fake *FakeLocalParticipant) SetTrackMutedCalls(stub func(livekit.TrackID, bool, bool) *livekit.TrackInfo) { func (fake *FakeLocalParticipant) SetTrackMutedCalls(stub func(*livekit.MuteTrackRequest, bool) *livekit.TrackInfo) {
fake.setTrackMutedMutex.Lock() fake.setTrackMutedMutex.Lock()
defer fake.setTrackMutedMutex.Unlock() defer fake.setTrackMutedMutex.Unlock()
fake.SetTrackMutedStub = stub fake.SetTrackMutedStub = stub
} }
func (fake *FakeLocalParticipant) SetTrackMutedArgsForCall(i int) (livekit.TrackID, bool, bool) { func (fake *FakeLocalParticipant) SetTrackMutedArgsForCall(i int) (*livekit.MuteTrackRequest, bool) {
fake.setTrackMutedMutex.RLock() fake.setTrackMutedMutex.RLock()
defer fake.setTrackMutedMutex.RUnlock() defer fake.setTrackMutedMutex.RUnlock()
argsForCall := fake.setTrackMutedArgsForCall[i] argsForCall := fake.setTrackMutedArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 return argsForCall.arg1, argsForCall.arg2
} }
func (fake *FakeLocalParticipant) SetTrackMutedReturns(result1 *livekit.TrackInfo) { func (fake *FakeLocalParticipant) SetTrackMutedReturns(result1 *livekit.TrackInfo) {
@@ -8602,6 +8458,68 @@ func (fake *FakeLocalParticipant) UpdateMediaRTTArgsForCall(i int) uint32 {
return argsForCall.arg1 return argsForCall.arg1
} }
func (fake *FakeLocalParticipant) UpdateMetadata(arg1 *livekit.UpdateParticipantMetadata, arg2 bool) error {
fake.updateMetadataMutex.Lock()
ret, specificReturn := fake.updateMetadataReturnsOnCall[len(fake.updateMetadataArgsForCall)]
fake.updateMetadataArgsForCall = append(fake.updateMetadataArgsForCall, struct {
arg1 *livekit.UpdateParticipantMetadata
arg2 bool
}{arg1, arg2})
stub := fake.UpdateMetadataStub
fakeReturns := fake.updateMetadataReturns
fake.recordInvocation("UpdateMetadata", []interface{}{arg1, arg2})
fake.updateMetadataMutex.Unlock()
if stub != nil {
return stub(arg1, arg2)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeLocalParticipant) UpdateMetadataCallCount() int {
fake.updateMetadataMutex.RLock()
defer fake.updateMetadataMutex.RUnlock()
return len(fake.updateMetadataArgsForCall)
}
func (fake *FakeLocalParticipant) UpdateMetadataCalls(stub func(*livekit.UpdateParticipantMetadata, bool) error) {
fake.updateMetadataMutex.Lock()
defer fake.updateMetadataMutex.Unlock()
fake.UpdateMetadataStub = stub
}
func (fake *FakeLocalParticipant) UpdateMetadataArgsForCall(i int) (*livekit.UpdateParticipantMetadata, bool) {
fake.updateMetadataMutex.RLock()
defer fake.updateMetadataMutex.RUnlock()
argsForCall := fake.updateMetadataArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeLocalParticipant) UpdateMetadataReturns(result1 error) {
fake.updateMetadataMutex.Lock()
defer fake.updateMetadataMutex.Unlock()
fake.UpdateMetadataStub = nil
fake.updateMetadataReturns = struct {
result1 error
}{result1}
}
func (fake *FakeLocalParticipant) UpdateMetadataReturnsOnCall(i int, result1 error) {
fake.updateMetadataMutex.Lock()
defer fake.updateMetadataMutex.Unlock()
fake.UpdateMetadataStub = nil
if fake.updateMetadataReturnsOnCall == nil {
fake.updateMetadataReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.updateMetadataReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeLocalParticipant) UpdateSignalingRTT(arg1 uint32) { func (fake *FakeLocalParticipant) UpdateSignalingRTT(arg1 uint32) {
fake.updateSignalingRTTMutex.Lock() fake.updateSignalingRTTMutex.Lock()
fake.updateSignalingRTTArgsForCall = append(fake.updateSignalingRTTArgsForCall, struct { fake.updateSignalingRTTArgsForCall = append(fake.updateSignalingRTTArgsForCall, struct {
+16 -19
View File
@@ -34,7 +34,6 @@ import (
"github.com/livekit/protocol/observability" "github.com/livekit/protocol/observability"
"github.com/livekit/protocol/observability/roomobs" "github.com/livekit/protocol/observability/roomobs"
"github.com/livekit/protocol/rpc" "github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/signalling"
"github.com/livekit/protocol/utils" "github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid" "github.com/livekit/protocol/utils/guid"
"github.com/livekit/protocol/utils/must" "github.com/livekit/protocol/utils/must"
@@ -577,7 +576,7 @@ func (r *RoomManager) StartSession(
participant.AddTrack(addTrackRequest) participant.AddTrack(addTrackRequest)
} }
if pi.PublisherOffer != nil { if pi.PublisherOffer != nil {
participant.HandleOffer(signalling.FromProtoSessionDescription(pi.PublisherOffer)) participant.HandleOffer(pi.PublisherOffer)
} }
go r.rtcSessionWorker(room, participant, requestSource) go r.rtcSessionWorker(room, participant, requestSource)
@@ -779,7 +778,10 @@ func (r *RoomManager) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
participant.GetLogger().Errorw("cannot unmute track, remote unmute is disabled", nil) participant.GetLogger().Errorw("cannot unmute track, remote unmute is disabled", nil)
return nil, ErrRemoteUnmuteNoteEnabled return nil, ErrRemoteUnmuteNoteEnabled
} }
track := participant.SetTrackMuted(livekit.TrackID(req.TrackSid), req.Muted, true) track := participant.SetTrackMuted(&livekit.MuteTrackRequest{
Sid: req.TrackSid,
Muted: req.Muted,
}, true)
return &livekit.MuteRoomTrackResponse{Track: track}, nil return &livekit.MuteRoomTrackResponse{Track: track}, nil
} }
@@ -789,28 +791,23 @@ func (r *RoomManager) UpdateParticipant(ctx context.Context, req *livekit.Update
return nil, err return nil, err
} }
participant.GetLogger().Debugw("updating participant", if err = participant.UpdateMetadata(&livekit.UpdateParticipantMetadata{
"metadata", req.Metadata, Name: req.Name,
"permission", req.Permission, Metadata: req.Metadata,
"attributes", req.Attributes, Attributes: req.Attributes,
) }, true); err != nil {
if err = participant.CheckMetadataLimits(req.Name, req.Metadata, req.Attributes); err != nil {
return nil, err return nil, err
} }
if req.Name != "" {
participant.SetName(req.Name)
}
if req.Metadata != "" {
participant.SetMetadata(req.Metadata)
}
if req.Attributes != nil {
participant.SetAttributes(req.Attributes)
}
if req.Permission != nil { if req.Permission != nil {
participant.GetLogger().Debugw(
"updating participant permission",
"permission", req.Permission,
)
participant.SetPermission(req.Permission) participant.SetPermission(req.Permission)
} }
return participant.ToProto(), nil return participant.ToProto(), nil
} }
+5 -1
View File
@@ -53,7 +53,11 @@ func (s whipService) Create(ctx context.Context, req *rpc.WHIPCreateRequest) (*r
return nil, ErrParticipantNotFound return nil, ErrParticipantNotFound
} }
if err := lp.HandleOffer(webrtc.SessionDescription{Type: webrtc.SDPTypeOffer, SDP: req.OfferSdp}, 0); err != nil { if err := lp.HandleOffer(&livekit.SessionDescription{
Type: webrtc.SDPTypeOffer.String(),
Sdp: req.OfferSdp,
Id: 0,
}); err != nil {
lp.GetLogger().Errorw("whip service: could not handle offer", err) lp.GetLogger().Errorw("whip service: could not handle offer", err)
return nil, err return nil, err
} }