mirror of
https://github.com/livekit/livekit.git
synced 2026-04-28 21:25:28 +00:00
in some implementations of Store, particpant and their tracks may not yet have been persisted when a mute event is received, don't want to error in that case (#714)
This commit is contained in:
@@ -167,25 +167,13 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// find the track
|
||||
t := funk.Find(participant.Tracks, func(t *livekit.TrackInfo) bool {
|
||||
return t.Sid == req.TrackSid
|
||||
})
|
||||
if t == nil {
|
||||
return nil, twirp.NotFoundError(ErrTrackNotFound.Error())
|
||||
}
|
||||
|
||||
err = s.writeParticipantMessage(ctx, livekit.RoomName(req.Room), livekit.ParticipantIdentity(req.Identity), &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_MuteTrack{
|
||||
MuteTrack: req,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var track *livekit.TrackInfo
|
||||
@@ -215,7 +203,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
|
||||
res = &livekit.MuteRoomTrackResponse{
|
||||
Track: track,
|
||||
}
|
||||
return
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error) {
|
||||
|
||||
Reference in New Issue
Block a user