Implements protocol 3 speaker updates (#120)
* Disallow AddTrack from participants that don't have the permission * Support protocol 3 speaker updates, client info * update protocol * Disallow AddTrack from participants that don't have the permission * increase wait time for GH to pass
This commit is contained in:
@@ -227,10 +227,12 @@ func (r *LocalRoomManager) StartSession(ctx context.Context, roomName string, pi
|
||||
"room", roomName,
|
||||
"nodeID", r.currentNode.Id,
|
||||
"participant", pi.Identity,
|
||||
"protocol", pi.ProtocolVersion,
|
||||
"sdk", pi.Client.Sdk,
|
||||
"sdkVersion", pi.Client.Version,
|
||||
"protocol", pi.Client.Protocol,
|
||||
)
|
||||
|
||||
pv := types.ProtocolVersion(pi.ProtocolVersion)
|
||||
pv := types.ProtocolVersion(pi.Client.Protocol)
|
||||
rtcConf := *r.rtcConfig
|
||||
rtcConf.SetBufferFactory(room.GetBufferFactor())
|
||||
participant, err = rtc.NewParticipant(rtc.ParticipantParams{
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -66,7 +67,6 @@ func (s *RTCService) validate(r *http.Request) (string, routing.ParticipantInit,
|
||||
|
||||
roomName := r.FormValue("room")
|
||||
reconnectParam := r.FormValue("reconnect")
|
||||
protocolParam := r.FormValue("protocol")
|
||||
autoSubParam := r.FormValue("auto_subscribe")
|
||||
|
||||
if onlyName != "" {
|
||||
@@ -79,13 +79,11 @@ func (s *RTCService) validate(r *http.Request) (string, routing.ParticipantInit,
|
||||
AutoSubscribe: true,
|
||||
Metadata: claims.Metadata,
|
||||
Hidden: claims.Video.Hidden,
|
||||
Client: s.parseClientInfo(r.Form),
|
||||
}
|
||||
if autoSubParam != "" {
|
||||
pi.AutoSubscribe = boolValue(autoSubParam)
|
||||
}
|
||||
if pv, err := strconv.Atoi(protocolParam); err == nil {
|
||||
pi.ProtocolVersion = int32(pv)
|
||||
}
|
||||
pi.Permission = permissionFromGrant(claims.Video)
|
||||
|
||||
return roomName, pi, http.StatusOK, nil
|
||||
@@ -134,7 +132,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
sigConn := NewWSSignalConnection(conn)
|
||||
if types.ProtocolVersion(pi.ProtocolVersion).SupportsProtobuf() {
|
||||
if types.ProtocolVersion(pi.Client.Protocol).SupportsProtobuf() {
|
||||
sigConn.useJSON = false
|
||||
}
|
||||
|
||||
@@ -201,3 +199,23 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *RTCService) parseClientInfo(values url.Values) *livekit.ClientInfo {
|
||||
ci := &livekit.ClientInfo{}
|
||||
if pv, err := strconv.Atoi(values.Get("protocol")); err == nil {
|
||||
ci.Protocol = int32(pv)
|
||||
}
|
||||
sdkString := values.Get("sdk")
|
||||
switch sdkString {
|
||||
case "js":
|
||||
ci.Sdk = livekit.ClientInfo_JS
|
||||
case "ios":
|
||||
ci.Sdk = livekit.ClientInfo_IOS
|
||||
case "android":
|
||||
ci.Sdk = livekit.ClientInfo_ANDROID
|
||||
case "flutter":
|
||||
ci.Sdk = livekit.ClientInfo_FLUTTER
|
||||
}
|
||||
ci.Version = values.Get("version")
|
||||
return ci
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user