Move callbacks out of messageRouter (#269)

* move callbacks out of messageRouter

* OCD

* more OCD

* fix forwarder test

* even more OCD

* maximum OCD

* package name collision, copy lock by value
This commit is contained in:
David Colburn
2021-12-17 13:19:23 -08:00
committed by GitHub
parent a06edd885e
commit faa870de3d
82 changed files with 315 additions and 527 deletions
+2 -1
View File
@@ -3,8 +3,9 @@ package rtc_test
import (
"testing"
"github.com/livekit/livekit-server/pkg/rtc"
"github.com/stretchr/testify/require"
"github.com/livekit/livekit-server/pkg/rtc"
)
const (
+1 -1
View File
@@ -1,7 +1,7 @@
package rtc_test
import (
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils"
"github.com/livekit/livekit-server/pkg/rtc/types"
+1 -1
View File
@@ -3,7 +3,7 @@ package rtc
import (
"strings"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/pion/sdp/v3"
"github.com/pion/webrtc/v3"
)
+1 -1
View File
@@ -3,7 +3,7 @@ package rtc
import (
"testing"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/pion/webrtc/v3"
"github.com/stretchr/testify/require"
)
+1 -2
View File
@@ -21,9 +21,8 @@ func TestTrackInfo(t *testing.T) {
Muted: true,
}
ti2 := ti
mt := NewMediaTrack(&webrtc.TrackRemote{}, MediaTrackParams{
TrackInfo: &ti2,
TrackInfo: &ti,
})
outInfo := mt.ToProto()
require.Equal(t, ti.Muted, outInfo.Muted)
+3 -4
View File
@@ -17,12 +17,11 @@ import (
"github.com/pkg/errors"
"google.golang.org/protobuf/proto"
"github.com/livekit/livekit-server/pkg/sfu"
"github.com/livekit/livekit-server/pkg/sfu/twcc"
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/routing"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu"
"github.com/livekit/livekit-server/pkg/sfu/twcc"
"github.com/livekit/livekit-server/pkg/telemetry"
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
"github.com/livekit/livekit-server/version"
@@ -289,7 +288,7 @@ func (p *ParticipantImpl) OnClose(callback func(types.Participant)) {
func (p *ParticipantImpl) HandleOffer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error) {
p.params.Logger.Debugw("answering pub offer",
"state", p.State().String(),
//"sdp", sdp.SDP,
// "sdp", sdp.SDP,
)
if err = p.publisher.SetRemoteDescription(sdp); err != nil {
+5 -5
View File
@@ -4,7 +4,7 @@ import (
"testing"
"time"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/pion/webrtc/v3"
"github.com/stretchr/testify/require"
@@ -92,8 +92,8 @@ func TestTrackPublishing(t *testing.T) {
t.Run("sends back trackPublished event", func(t *testing.T) {
p := newParticipantForTest("test")
//track := &typesfakes.FakePublishedTrack{}
//track.IDReturns("id")
// track := &typesfakes.FakePublishedTrack{}
// track.IDReturns("id")
sink := p.params.Sink.(*routingfakes.FakeMessageSink)
p.AddTrack(&livekit.AddTrackRequest{
Cid: "cid",
@@ -115,8 +115,8 @@ func TestTrackPublishing(t *testing.T) {
t.Run("should not allow adding of duplicate tracks", func(t *testing.T) {
p := newParticipantForTest("test")
//track := &typesfakes.FakePublishedTrack{}
//track.IDReturns("id")
// track := &typesfakes.FakePublishedTrack{}
// track.IDReturns("id")
sink := p.params.Sink.(*routingfakes.FakeMessageSink)
p.AddTrack(&livekit.AddTrackRequest{
Cid: "cid",
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"testing"
"time"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/stretchr/testify/require"
"github.com/livekit/livekit-server/pkg/config"
+2 -1
View File
@@ -1,9 +1,10 @@
package rtc
import (
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/livekit-server/pkg/rtc/types"
)
func HandleParticipantSignal(room types.Room, participant types.Participant, req *livekit.SignalRequest, pLogger logger.Logger) error {
+3 -2
View File
@@ -5,11 +5,12 @@ import (
"time"
"github.com/bep/debounce"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils"
"github.com/pion/webrtc/v3"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/pkg/sfu"
)
const (
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"testing"
"time"
livekit "github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/livekit"
"github.com/pion/webrtc/v3"
"github.com/stretchr/testify/require"