Placeholder-Software / Dissonance

Unity Voice Chat Asset
71 stars 5 forks source link

[bug] Voice chat de-synchronized after phone turns off and turns back on. #209

Closed liyichen7887 closed 3 years ago

liyichen7887 commented 4 years ago

Context

Hi Placeholder Software Team,

This might be a bug, but I'm not 100% sure. I'm trying to use Dissonance with Photon Unity Network to build an app across PC, Android, and IOS platforms. I recently found an issue that voice chat will de-synchronize after the phone turns off and turns back on.

Expected Behavior

For the first time connecting, all players are good. The chats are synced and with little lag. However, issues started to appear when I turned off a phone (turn off screen) and turn it back on. During this period, other players were keeping inputting voice, and when the phone was back on, I'm expecting that the voice chat on the phone will work as for the first time. It should resume the connection and starting to receive the latest voice chat from other players.

Actual Behavior

However, in this case, the chat was de-synchronized on the phone. Here is what happened. it would actually first receive the chat stack during the phone's off period and then started to receive new chats from others. It would start to be more synced when it finished the “playback”, but it still had great lag receiving new chats. And this would prevent the phone from inputting voice, and other players could not hear the phone.

Steps to Reproduce

  1. Turn off the phone screen and turn it back on.

Your Environment

martindevans commented 3 years ago

This is something I've recently looked into for another user. The main issue seems to be that certain network backends (e.g. PUN) buffer up packets that cannot be delivered and then when the app resumes it delivers them all in one go. Dissonance tries to play this huge backlog of audio and ends up very out-of-sync!

I'm just about to publish a new version of Dissonance to the asset store that includes a fix for this issue. It should be available within a week (it takes a while for Unity to review new releases).

I also replied to you on Reddit about this issue :)

martindevans commented 3 years ago

Dissonance 7.1.2 has been released onto the asset store with built in support for suspending and resuming Dissonance when the app is suspended.