Internal clients always may subscribe all streams.

Follow-up to #133.
This commit is contained in:
Joachim Bauch 2021-10-11 13:44:54 +02:00
parent aeb7834ff7
commit c51276596b
No known key found for this signature in database
GPG Key ID: 77C1D22D53E15F02
1 changed files with 7 additions and 1 deletions

8
hub.go
View File

@ -1677,6 +1677,11 @@ func sendMcuProcessingFailed(session *ClientSession, message *ClientMessage) {
}
func (h *Hub) isInSameCall(senderSession *ClientSession, recipientSessionId string) bool {
if senderSession.ClientType() == HelloClientTypeInternal {
// Internal clients may subscribe all streams.
return true
}
senderRoom := senderSession.GetRoom()
if senderRoom == nil || !senderRoom.IsSessionInCall(senderSession) {
// Sender is not in a room or not in the call.
@ -1690,7 +1695,8 @@ func (h *Hub) isInSameCall(senderSession *ClientSession, recipientSessionId stri
}
recipientRoom := recipientSession.GetRoom()
if recipientRoom == nil || !senderRoom.IsEqual(recipientRoom) || !recipientRoom.IsSessionInCall(recipientSession) {
if recipientRoom == nil || !senderRoom.IsEqual(recipientRoom) ||
(recipientSession.ClientType() != HelloClientTypeInternal && !recipientRoom.IsSessionInCall(recipientSession)) {
// Recipient is not in a room, a different room or not in the call.
return false
}