-
-
Notifications
You must be signed in to change notification settings - Fork 789
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
When the RTMP server channel is closed, the error message related to the incorrect socket is not received in the onConnectionFailed
method.
#1583
Comments
Hello, Can you tell me your server name and version. And the command used to close the channel to reproduce the case? |
Hi @pedroSG94, sorry for the confusion. We are using our streaming console to play the live stream, where users can click a "Close Live Stream" button to stop the stream. I tested on several virtual devices—some worked, and some didn't. However, none of the physical devices worked. I'm not sure if this issue is related to the socket. I suspect the exception occurs in the flush method of the TcpSocket class. I also tested the sample app you provided, and the issue is the same. Additionally, when I receive an error and call the retry API, the reConnect method does not work. It seems that the retry scope is not being launched. As shown in the attached image, the log only shows "reConnect 1" without "reConnect 2": |
Hello, About the error, no notified: About reconnect: |
Hi @pedroSG94, Apologies, but in order to assist you with setting up a streaming test environment on our console, I will need to get approval from my supervisor and submit a request. Additionally, I found that
I tried adjusting the method like this, and it works. Do you have any thoughts on this code change?
|
Hello, Thank you for the debug and your suggestion, but create a thread each time flush is called is a really bad idea. I did a timeout in the command that fail because this only fail when the disconnect method is called. This is the fix: About the other error. I only need info about your server name (Wowza engine, mediamtx, nginx with rtmp module, etc), the version and the command used to close the stream. If it is a free server or I can create an account with a trial I can create the environment by myself. |
Hi @pedroSG94 Apologies, but our servers are self-hosted and not free. Still can’t solve it . There are two main reasons:
|
Hello, Ok, thank you for the info. This could explain both errors. I will create a new branch to handle this case but I need your help here to test if the error is solved. |
Hello, @pedroSG94 Thank you for your explanation. I would be happy to assist in testing the solution for this issue. Please feel free to share the details or steps you'd like me to follow, and I will promptly help to verify if the error is resolved. |
Hello, Please, compile this branch and tell me if the change fix the problem: |
Hello, @pedroSG94 I tried the fix, but the problem is still not resolved. The sample app continues to show 0.0mb/s when I close it from our console, and logcat keeps printing "frames discarded." I noticed something interesting: when I switch the network status, it no longer locks up and throws socket errors. Screen_Recording_20240919_001813.1.mp4Is this problem related to the network status? |
Hello, That socket error on the switch network is the expected way to work. I also did tests doing a server shutdown while streaming and all worked as expected (socket throw an error). The weird case is your case, because that should works like shutdown the server but instead of that the socket is blocked. For now, I'm looking to migrate the socket to ktor socket library but I also need to do performance tests. Can you do a test? Can you try stream and instead of close the stream using the command, shutdown the server? |
Hello, I did a migration to ktor socket that is based on coroutines. Now, the library never should be blocked and all should be working fine. Can you update the branch and try again? |
Hello @pedroSG94 , Sorry for the late reply. You’ve saved my life! 👍 Screen_Recording_20240919_171606.1.mp4 |
Hello, Nice, it is working fine but I can see that the timeout is really high (around 20s) or you are closing the stream in other moment, I'm not sure. I need to see that. implementation 'com.github.pedroSG94.RootEncoder:library:d459b91a75' This change is really large so this could take days. Also, I need do more performance tests using a high bitrates to confirm that the performance is similar |
Hello, Got it. I'll wait for your publish notification. |
Hello, @pedroSG94, I tried it again and called the retry() API when the stream is closed. Do you have any insights on this issue?
|
Hello, That should be correct. |
Hello, |
Hello @pedroSG94,
This would allow me to retry the connection when receiving override fun onConnectionFailed(reason: ConnectionFailed) {
// handle connection failure
} |
Hello, Yes, it is possible but this will take time. I will mark this issue as feature |
Hello, Both features was added to master branch. Closing as completed |
Hi @pedroSG94
Describe the bug
When the RTMP server channel is closed, the error message related to the incorrect socket is not received in the
onConnectionFailed
method. I tested this on both virtual and physical devices.onConnectionFailed
method.onConnectionFailed
method.To Reproduce
Steps to reproduce the issue:
Expected behavior
When the RTMP server channel is closed, an error message related to the incorrect socket should be received in the
onConnectionFailed
method.Smartphone (please complete the following information):
Virtual Device:
Physical Device:
The text was updated successfully, but these errors were encountered: