decouple websocket and RTC nodes, prep for distributed

This commit is contained in:
David Zhao
2021-01-16 10:37:38 -08:00
parent 9a10a57b30
commit 9064f6ade1
61 changed files with 2683 additions and 1361 deletions
+14 -1
View File
@@ -5,8 +5,11 @@ import (
"io"
"strings"
"github.com/google/wire"
"github.com/pion/webrtc/v3"
"go.uber.org/zap"
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/logger"
"github.com/livekit/livekit-server/pkg/rtc/types"
"github.com/livekit/livekit-server/proto/livekit"
@@ -16,6 +19,15 @@ const (
trackIdSeparator = "|"
)
var RTCSet = wire.NewSet(
NewWebRTCConfig,
RTCConfigFromConfig,
)
func RTCConfigFromConfig(conf *config.Config) *config.RTCConfig {
return &conf.RTC
}
func UnpackTrackId(packed string) (peerId string, trackId string) {
parts := strings.Split(packed, trackIdSeparator)
if len(parts) > 1 {
@@ -118,6 +130,7 @@ func RecoverSilent() {
func Recover() {
if r := recover(); r != nil {
logger.GetLogger().Errorw("recovered panic", "err", r)
log := logger.Desugar().WithOptions(zap.AddCallerSkip(1))
log.Error("recovered panic", zap.Any("error", r))
}
}