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

Please improve socket error handlings / recovery in unreliable wifi network #245

Closed
zwei333 opened this issue Mar 5, 2020 · 7 comments
Closed
Assignees
Labels
question Further information is requested

Comments

@zwei333
Copy link

zwei333 commented Mar 5, 2020

Our wifi network in office is very noisy, and our camera's wifi driver is not the best, so the webrtc is running in a very tough wifi environment.
Although this scenario is rare in the field, it is a very good stress test of kvs software error resilience.
We need help to improve the socket error handling in this extreme condition so that the video is still barely acceptable.
In our office, we see these errors:

  1. "socketConnectionSendData(): Failed to send data. Socket closed already."
    status code 0x58000022
    Not sure if it is necessary to close socket. And after socket is closed, maybe we should quickly reconnect. Current code calls socketConnectionSendData() many times, getting many of error messages, and video is frozen
  2. "socketConnectionSendData(): sendto data failed with errno" "Resource temporarily unavailable"
    status code 0x5800001a
    Sending fails and then frames dropped. When the error happens, the error repeats many times, and webrtc drops a lot of frames. Looks like re-transmission kicks in that causes significant latency, as much as 5 seconds.
    Like to see improved strategy of dropping frames and re-transmiting, so that latency won't increase too much in noisy wifi network.
@chehefen
Copy link
Contributor

chehefen commented Mar 9, 2020

Hi, is your master and viewer running in the same network or are you using turn?
for issue #1, is it happening after the ice got connected and start streaming?
for issue #2, it could be that you are filling the kernel send buffer. you can try give it a larger size here: https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/blob/master/src/include/com/amazonaws/kinesis/video/webrtcclient/Include.h#L667

@zwei333
Copy link
Author

zwei333 commented Mar 9, 2020

Thanks!
Issue #1, Streaming was running before the socket error.
Issue #2, I will try it. It is very helpful.
Again, our wifi in a corner of our office is bad. So I use this spot to test the robustness of kvs code

@zwei333
Copy link
Author

zwei333 commented Mar 10, 2020

Can you resend link for "for issue #2, it could be that you are filling the kernel send buffer. you can try give it a larger size here: "? Maybe there are new check-ins. The specified line does not have code to change buffer size

@chehefen
Copy link
Contributor

Hi @zwei333 , any updates regarding issues you posted? For issue 1, the RtcOnConnectionStateChange should be invoked with either RTC_PEER_CONNECTION_STATE_FAILED or RTC_PEER_CONNECTION_STATE_CLOSED and you should tear down and recreate the peerConnection again.

@MushMal
Copy link
Contributor

MushMal commented Mar 18, 2020

@zwei333 any update?

@MushMal MushMal added the question Further information is requested label Mar 18, 2020
@chehefen
Copy link
Contributor

@zwei333 #2 should be fixed by #279. can you try it out? Thanks

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

No branches or pull requests

4 participants