Files
livekit/pkg/service/utils.go
David Zhao a96069969d support audio level extension & active speaker detection (#20)
* send active speaker updates with audio level

* add test on loudness sorting

* use a float to represent audio level
2021-02-14 14:30:23 -08:00

37 lines
938 B
Go

package service
import (
"net/http"
"github.com/google/wire"
"go.uber.org/zap"
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/logger"
"github.com/livekit/livekit-server/pkg/routing"
"github.com/livekit/livekit-server/pkg/rtc"
"github.com/livekit/livekit-server/proto/livekit"
)
var ServiceSet = wire.NewSet(
NewRoomService,
NewRTCService,
NewLivekitServer,
NewRoomManager,
config.GetAudioConfig,
wire.Bind(new(livekit.RoomService), new(*RoomService)),
externalIpFromNode,
)
// helper to construct RTCConfig
func externalIpFromNode(currentNode routing.LocalNode) rtc.ExternalIP {
return rtc.ExternalIP(currentNode.Ip)
}
func handleError(w http.ResponseWriter, status int, msg string) {
l := logger.Desugar().WithOptions(zap.AddCallerSkip(1))
l.Debug("error handling request", zap.String("error", msg), zap.Int("status", status))
w.WriteHeader(status)
w.Write([]byte(msg))
}