-
-
Notifications
You must be signed in to change notification settings - Fork 785
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
Add control over cacheSize, customizable hasCongestion #1302
Comments
Hello, You are right. I added an optional value for it: Anyway, I also detected a bug in that method and it was updated in the last release and it should work as expected with the current default value: Let me know if it is working as you expected to fix/update the PR and merge it |
Thanks a lot! That bug in kotlin version of hasCongestion was the issue. |
I will test the PR a bit and merge for next version |
@pedroSG94 there's another major problem: Here's how I test:
Result I see a lot of dropped frames, not affecting the queue size or bandwidth sent, so quality is not decreasing with Adapter |
at first about 200 frames get sent, 0 dropped, then all frames get dropped until there's timeout, it disconnects. |
I will try to check it but I'm not sure about the logic because dropped frames only increase if the queue is full and you try to enqueue other frame. I can't do the suggested way to test because I only have an iPad without mobile data (only WiFi). I will try to find other way to reproduce it |
Maybe rtmp sender stuck sending a frame so the queue is always full. I will try to find a way to check it |
It's weird.. Im trying to check droppedVideoFrames onNewBitrateRtmp like this:
to use the result in adaptBitrate but here's what I get: first few seconds 0 dropped, 31 sent video, but then I get Any ideas? |
If the send thread is stucked it is normal because that callback is called in that thread. The question is why the send thread stuck for 30s I'm looking a way to limit bandwidth and test it |
I think at some point all frames get dropped and while they're all dropped, onNewBitrateRtmp is not called. |
Can you tell me bitrate used on the library? Also, I assume that 3500 is kbps of upload bandwidth limit, right? |
Because this listener use a different thread. It is using the GL render thread. You can use it but you will have the same problem and the sender thread will keep stucked. |
Ok, yes hopefully you can find how to get it unstuck, or run calculation on another thread so we can properly react (Reduce bitrate when frames are being dropped) |
I can limit bandwidth but I can't reproduce the case for stuck the sending thread. I expect that after this, your sender thread never should stuck but you still lose frames as expected. Let me know if it is working and I will try find a fix |
what's the best way to import the library as source to test it? Currently using the library like this: |
Try this way: |
Ok I've successfully added the library, and tried commending the line solution, but unfortunately the situation is the same, dropped frames pile up and no new onNewBitrate calls until after several seconds the stream is disconnected for not sending any data.. |
rtmpCamera2.resizeCache(30); |
Hello, At least I can discard that read while writing is the reason. About resize cache this has no effect because the problem is not related with cache size. it is related with the sender thread stopping to send. Now we can check which method stuck the thread. Print few logs here: Also, in iphone configuration try to remove "perda di pacote di saida" and "atraso di saida" to discard that it is the problem. In my case I only was able to produce discard frames that is the expected way that the library should works but it is never stucked. Other test could be use a different device to know if you only can reproduce it with one device |
ok I tested on 2 devices:
This happens when there's any "packet loss" Frames just get discarded continiously:
Any way to detect it to lower bitrate? My idea is something like this:
but onNewBitrateRtmp is not called while many frames are discarded (I can see new getDroppedVideoFrames count in |
Hello, This will guarantee that bitratemanager is called each second no matter if sender thread is blocked or not: Now, the only problem is the reason about the sender never finish to send a packet. If possible try to test using the app mentioned above to use the same environment than me and know if the problem is related with iPhone limiter. If it is the case I can considerate buy an old iPhone to reproduce the case and try to fix it if possible. |
Do you means that remove packet loss in the iPhone limiter fix the problem? This could be related with TCP protocol. It is a protocol that need that server response to confirm that the packet is send and if it fail, it will do a retry because it is a protocol that guarantee that all is correctly received in the other side. |
Thank you! This was extremely helpful! Now I was able to add to my custom bitrate adapter, if there are any dropped frames I immediately drop bitrate to the minumum and this lets me continue the stream without drops. |
Ok, I will add a method for it today |
Added here: |
All this changes was added to version 2.3.1 |
Is your feature request related to a problem? Please describe.
While implementing a custom bitrateAdapter it became clear that hasCongestion method cannot be relied upon, because it always return true on all devices.
The method and RTMPSender class have hardcoded values for cache size and fullness criteria
The itemsInQueue is private, so it cannot be read from the outside
Describe the solution you'd like
Make 0.2f hardcoded magic value customizable, and/or make itemsInQueue public so the queue could be better inspected in a custom bitrateAdapter.
Describe alternatives you've considered
tried not using hasCongestion, but it's prone to creating a stream drop
Additional context
The text was updated successfully, but these errors were encountered: