decouple websocket and RTC nodes, prep for distributed
This commit is contained in:
+14
-1
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user