Crashes due to local muting in a positional Channel

I’ve been noticing some relatively frequent crashes while setting LocalMute on a positional channel once I start hitting about 4-6 clients in the channel. I think it may be exasperated by the fact that I’m currently checking/setting LocalMute in fixed update (so the setter gets set every frame until the response comes back from the vivox service.)

if (participant.LocalMute != muted)
{
    SDebug.Log($"setting Mute status of {participant.Account.DisplayName} to {muted}");
    participant.LocalMute = muted;
}

If it is in fact sending an actual request every frame this runs, does sending too many requests to mute (or too many requests in general) per frame increase the odds of a crash to desktop? It’s totally fine if it does, I can definitely improve my implementation, but I just wanna wrap my head around why this might be happening.

Hey buddy, why have you chosen to do this on update!?
I am new to vivox and doing my RnD on it myself.
There is a callback you can register to to get the status of the user in that channel, so you just need to register to it and when it calls your registered method you can check if it is muted.
You don’t have to keep checking on update if that’s what you are doing !?!

You need to register to → IChannelSession.Participants.AfterValueUpdated
Sample to handle mute on callback is here

I believe this should serve your purpose instead of using update. The problem with your implementation is you keep calling the mute API, it obviously takes time to switch states but in the meantime, you have sent multiple mute requests.
I would suggest calling it once on button press and then in the callback check if its muted and then you can update your states or UI

@SpikeDevelops it seems you have been able to achieve multiple user connections to the same channel could you help me out there, I have posted a help request for it. I may have missed out something here, this is my post

THANK YOU.

I don’t think you should be checking if every frame is “muted” on Fixed Update, depending on the system that’s [20-60+] extra calls every second!!! Like @jeeth_unity mentioned it’s not necessary to call every frame. I guess it depends on your case though, which you didn’t explain, so if you can elaborate why you need to check Local Mute so often maybe I can help you more. My Discord link is below if you need to share code or want to discuss further. I will respond to this conversation as well, although I think Discord is better for code sharing and possible video chat if it comes to that,

https://discord.gg/XX3uvYT4t6

Thanks for the responses! I should’ve clarified yea. I’ve got a system that mutes players locally based on what “room” they’re in (so you can only hear other players if you’re in the same room with them), so for each client I’m muting/unmuting based on that. So that logic runs every frame, and then for each participant in the channel I set their local mute accordingly.

I did end up switching to a system that waits for the callback after I set LocalMute the “first” time it switches, and if its not successful, tries again. That system has so far completely removed the crashing that I was experiencing, but my testing sample size isn’t too huge.

1 Like

Glad you figured out a fix for it. You could also use a Coroutine as well instead of calling your logic in every frame.

     IEnumerator Mute(IParticipant participant)
        {
            yield return new WaitUntil(() => participant.LocalMute != muted);
            SDebug.Log($"setting Mute status of {participant.Account.DisplayName} to {muted}");
            participant.LocalMute = muted;
        }

and then just use StartCoroutine(Mute(participant));

1 Like