accept any participant type source to BroadcastMetricsForRoom (#3063)
This commit is contained in:
@@ -1661,7 +1661,7 @@ func (p *ParticipantImpl) onDataMessage(kind livekit.DataPacket_Kind, data []byt
|
|||||||
// only forward on user payloads
|
// only forward on user payloads
|
||||||
switch payload := dp.Value.(type) {
|
switch payload := dp.Value.(type) {
|
||||||
case *livekit.DataPacket_User:
|
case *livekit.DataPacket_User:
|
||||||
if payload == nil || payload.User == nil {
|
if payload.User == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
u := payload.User
|
u := payload.User
|
||||||
@@ -1678,18 +1678,18 @@ func (p *ParticipantImpl) onDataMessage(kind livekit.DataPacket_Kind, data []byt
|
|||||||
dp.DestinationIdentities = u.DestinationIdentities
|
dp.DestinationIdentities = u.DestinationIdentities
|
||||||
}
|
}
|
||||||
case *livekit.DataPacket_SipDtmf:
|
case *livekit.DataPacket_SipDtmf:
|
||||||
if payload == nil || payload.SipDtmf == nil {
|
if payload.SipDtmf == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
case *livekit.DataPacket_Transcription:
|
case *livekit.DataPacket_Transcription:
|
||||||
if payload == nil || payload.Transcription == nil {
|
if payload.Transcription == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !p.IsAgent() {
|
if !p.IsAgent() {
|
||||||
shouldForwardData = false
|
shouldForwardData = false
|
||||||
}
|
}
|
||||||
case *livekit.DataPacket_ChatMessage:
|
case *livekit.DataPacket_ChatMessage:
|
||||||
if payload == nil || payload.ChatMessage == nil {
|
if payload.ChatMessage == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if p.IsAgent() && dp.ParticipantIdentity != "" && string(p.params.Identity) != dp.ParticipantIdentity {
|
if p.IsAgent() && dp.ParticipantIdentity != "" && string(p.params.Identity) != dp.ParticipantIdentity {
|
||||||
@@ -1698,7 +1698,7 @@ func (p *ParticipantImpl) onDataMessage(kind livekit.DataPacket_Kind, data []byt
|
|||||||
}
|
}
|
||||||
shouldForwardData = true
|
shouldForwardData = true
|
||||||
case *livekit.DataPacket_Metrics:
|
case *livekit.DataPacket_Metrics:
|
||||||
if payload == nil || payload.Metrics == nil {
|
if payload.Metrics == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
shouldForwardData = false
|
shouldForwardData = false
|
||||||
|
|||||||
+1
-1
@@ -1795,7 +1795,7 @@ func BroadcastDataPacketForRoom(r types.Room, source types.LocalParticipant, kin
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func BroadcastMetricsForRoom(r types.Room, source types.LocalParticipant, dp *livekit.DataPacket, logger logger.Logger) {
|
func BroadcastMetricsForRoom(r types.Room, source types.Participant, dp *livekit.DataPacket, logger logger.Logger) {
|
||||||
switch payload := dp.Value.(type) {
|
switch payload := dp.Value.(type) {
|
||||||
case *livekit.DataPacket_Metrics:
|
case *livekit.DataPacket_Metrics:
|
||||||
utils.ParallelExec(r.GetLocalParticipants(), dataForwardLoadBalanceThreshold, 1, func(op types.LocalParticipant) {
|
utils.ParallelExec(r.GetLocalParticipants(), dataForwardLoadBalanceThreshold, 1, func(op types.LocalParticipant) {
|
||||||
|
|||||||
Reference in New Issue
Block a user