Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]Switching mobile network will disconnect #246

Closed
hrxiang opened this issue Mar 2, 2023 · 21 comments
Closed

[bug]Switching mobile network will disconnect #246

hrxiang opened this issue Mar 2, 2023 · 21 comments

Comments

@hrxiang
Copy link

hrxiang commented Mar 2, 2023

Switching from wifi to mobile phone 4g or switching from 4g to wifi calls are directly interrupted and cannot be reconnected,
In the new version of sdk, the reconnection method is gone.

在通话的时候切换手机网络,从wifi到4g或从4g到wifi都会中断且直接丢失房间的连接,在1.2.0的sdk里重连方法不见了。

flutter 3.7.3
livekit_client 1.2.0
redmi note5 4g
android 8.1.0

@cloudwebrtc
Copy link
Contributor

cloudwebrtc commented Mar 2, 2023

We may need to monitor the current network type, and automatically trigger the re-connection when it changes

@hrxiang
Copy link
Author

hrxiang commented Mar 2, 2023

We may need to monitor the current network type, and automatically trigger the re-connection when it changes

The reconnection method is gone in the new sdk

@hrxiang
Copy link
Author

hrxiang commented Mar 2, 2023

Harmonys os 4g screen freezes

print log :org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full

@hrxiang
Copy link
Author

hrxiang commented Mar 2, 2023

Some mobile phones will automatically reconnect when switching networks in debug mode, but they are directly disconnected in release mode

在debug模式下切换网络会自动重连,但是在release模式下直接断开了

@davidzhao
Copy link
Member

The reconnection method is gone in the new sdk

What is the reconnection method?

@hrxiang
Copy link
Author

hrxiang commented Mar 2, 2023

The reconnection method is gone in the new sdk

What is the reconnection method?

 void _onTapReconnect() async {
    try {
      await room?.reconnect();
    } catch (error) {}
  }

@cloudwebrtc
Copy link
Contributor

okay, I made it an internal method in the last PR, but I think we need to reconnect by monitoring network changes instead of manually reconnecting?
https://github.com/livekit/client-sdk-flutter/pull/238/files

@cloudwebrtc
Copy link
Contributor

cloudwebrtc commented Mar 2, 2023

@hrxiang When you switch networks, can you observe that the signaling ws connection is disconnected? or nothing will happen

@hrxiang
Copy link
Author

hrxiang commented Mar 2, 2023

@hrxiang When you switch networks, can you observe that the signaling ws connection is disconnected? or nothing will happen

There will be reconnection in debug mode, and the release mode will be disconnected directly.

I used the 1.1.4 version to build the release package and it can be reconnected, but I used the 1.2.0 version to build the release package and disconnected directly.

I used the 1.2.0 version to build the debug package can be reconnected

@cloudwebrtc
Copy link
Contributor

okay, let me test it

@cloudwebrtc
Copy link
Contributor

Just tested, 1.2.0 uses the release mode, it can be reconnected after switching from WIFI to 5G, but the publisher successfully reconnects first, while the subscriber will lag behind for 3 to 5 seconds but will eventually reconnect, and the two-way video will return to normal.

@hrxiang
Copy link
Author

hrxiang commented Mar 2, 2023

Just tested, 1.2.0 uses the release mode, it can be reconnected after switching from WIFI to 5G, but the publisher successfully reconnects first, while the subscriber will lag behind for 3 to 5 seconds but will eventually reconnect, and the two-way video will return to normal.

4g phone.

@cloudwebrtc
Copy link
Contributor

same result on 4g network

@cloudwebrtc
Copy link
Contributor

But I observed an interesting phenomenon, the disconnection/new connection of ws signaling seen on the livekit-server has the same delay of 3-5 seconds, so this should be related to the delay of iOS sending WS socket disconnection event.

@hrxiang
Copy link
Author

hrxiang commented Mar 2, 2023

But I observed an interesting phenomenon, the disconnection/new connection of ws signaling seen on the livekit-server has the same delay of 3-5 seconds, so this should be related to the delay of iOS sending WS socket disconnection event.

Nova5 pro (Harmonys os 4g) mobile phone has this problem, but gt neo5 5g does not have this problem.

nova5 pro only supports 4G but not 5G

@cloudwebrtc
Copy link
Contributor

cloudwebrtc commented Mar 2, 2023

The current version depends on the disconnection of the WSS signaling to trigger the restartConnect/resumConnect, This method relies on the system to report the timeout of the Socket disconnect.

maybe we can adopt a more positive way as the preferred network changes, and actively re-connect,

@hrxiang
Copy link
Author

hrxiang commented Mar 2, 2023

Nova5 pro (Harmonys os 4g) mobile phone on the 1.2.0 version, the screen will freeze, but it is normal on <=1.1.4

@cloudwebrtc
Copy link
Contributor

Since I do not have a device that can reproduce the Issue,
Can you help REVERT the code in 1.2.0 SDK to test it?
5c4761b#diff-3a92e05d440158fbb2bd9af33b72cc5aba22adf50ca82f4e824477109fc58f95L309-L313

@davidzhao
Copy link
Member

Interesting.. if the issue is not sensing WS disconnection, we should have client-initiated pings that should detect this? Does peerconnection also not disconnect?

@hrxiang
Copy link
Author

hrxiang commented Mar 3, 2023

So sorry! Our server code here has not been upgraded, we are still using a version from long ago. After updating the servers, we occasionally lose connection when switching networks, most of the time this is normal.

Now there is a problem that the Huawei 4G mobile phone will be stuck after a while, but the sound can be heard

Repeated console output:

org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full
org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full
org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full
org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full
org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full
org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full
org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full
org.webrtc.Logging(19744): HardwareVideoEncoder: Dropped frame, encoder queue full

Is it the same issue as this one? open-webrtc-toolkit/owt-deps-webrtc#117

@cloudwebrtc
Copy link
Contributor

This may be a bug on a specific device, if this issue recurs frequently, please reopen this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants