I understand that this topic has been discussed before, but it seems that I have come across a regression related to the MobileVLCKit.
Some of my customers have complained about the slowness during RTSP stream loading. I have tried to identify the root of the problem, including checking device models and OS versions. However, I was not able to reproduce any weird behavior or slowness with the following devices:
iPhone 11 with iOS 15.6
iPhone 12 with iOS 16.1
iPhone 12 with iOS 16.4
iPhone 12 mini with iOS 15.3
iPad Air (4th gen) with iOS 15.6.
While I was unable to reproduce the issue on the Simulator, I faced the same issue as my customers when I compiled our app for my MB Pro (Apple M1 Pro chip). This issue existed in MobileVLCKit versions 3.5.1, 3.3.17, and 3.3.10, but was resolved in version 3.3.16.3.
The only difference I noticed between those versions is that in 3.3.16.3, the error "Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0" appears a couple of times immediately and the stream loads successfully. However, in other versions, this issue appears after some delay and then again repeatedly (but with some delay) until after a certain number of errors, the first frame appears.
This issue does not occur when using the official VLC player from the App Store, but it can be easily reproduced on other Xcode projects using MobileVLCKit. It occurs with different codecs and for each stream.
Additionally, I suspected that the issue might be related to the network, so I tested it on different WiFi networks and cellular connections.
One of my teammates was able to reproduce the delay on their device, an iPhone 11 with iOS 16.3.1. Furthermore, one of my customers who is also experiencing this problem is using an iPhone 14 Pro Max, although unfortunately, they did not mention the OS version they are using.
The difference in loading the stream between version 3.3.16.3 and 3.5.1 can be more than 20 seconds.
yes I am also facing this issue I am using the 3.4.0 version and some stream is not loading and some time stream is freezing so anyone have any solution please suggest here
Hi, Aalok!
You can try to lock the "MobileVLCKit" version to "3.3.16.3". But it's a temporary solution. I hope someone from the development team will reply to my request...
What do you mean by "it also return me that this version is also 3.4.0"?
I'm just having a huge delay before I get the first frame and after that, the stream behaves normally.
3.5.1 - more than 20 sec
3.3.16.3 - about 1.5 sec
After years of use of VLCKit on macOS, where the issue reported here (and also in #502 (closed) and #560 (closed)) never manifested, I've recently started experimenting with the library on iOS, and I'm also seeing the following message logged on the console:
Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0
This message is logged 4 to 6 times, with an interval of about 5 seconds between each, and any RTSP stream I have tested doesn't start playback until after the last iteration is logged (so, with a delay of at least 20 seconds before playback starts).
For me, this is happening using VLCKit 3.6.0b10 in an app running on iOS 17 that has been compiled on Xcode 15.0.
I have tested different devices, also running iOS 16, and on every one RTSP playback is dramatically delayed.
The message is not logged when running in the Simulator, where indeed playback is instantaneous.
My understanding of what's happening is extremely limited, but I tried reading everything that was posted on this issue and spelunking in code I don't really understand.
Please excuse if what follows isn't helpful to debug this.
My uneducated guess is that this issue might either be caused by:
A regression to a patch to Live555 from a couple years back (!91 (merged)), which I understand @fkuehne made to address the fact that iOS expects a hostname to have .local suffix;
Or, possibly, the fact that a similar request to the OS for the hostname happens somewhere else in the code, where it's not yet patched to include the required .local suffix.
I've tried opening the /libvlc/vlc/contrib/src/live555/rules.mak file in my cloned and built VLCKit 3.6.0b10 ƒ and it seems, to my ignorant eyes, that the necessary statements are still there:
... but I don't really know how patches are applied and I might be looking in the wrong place, or again maybe there are other functions that ask iOS for the hostname without the expected suffix, triggering the delay.
If the latter hypothesis were true, that additional and not-yet-patched request for the hostname must have been added after 3.3.10: the OP in #560 (closed) mentions they didn't experience the delay with that release.
Or maybe I am looking at this from the wrong side, and this is not a bug at all: after seeing mentioned on Apple forums that requesting a com.apple.developer.networking.multicast special entitlement would address the Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0 log message, I searched the issues here for any mention of that entitlement.
I found #638, which indeed refers to a significant delay in RTSP playback.
So, my question in case this is not a bug, but expected behavior: do I – and everyone else experiencing this (quite frequent, from what I've read) issue – just ask Apple for the com.apple.developer.networking.multicast entitlement?
Thanks in advance, and as always, for any suggestions; I am obviously happy to test anything that might help.
We are aware of the problem, but we are unable to reproduce this in a reliable manner. Also, the reports on this tracker are of intermittent detail. We'd be happy to have a look especially if we were provided with a sample stream that can be reliably used for weeks (if you tell us which webcam to buy, that's also possible). We can also provide consulting services if needed.
Regarding my patch, it made things better in the iOS 13/14 era if I remember correctly. With iOS 17, that code path is more or less dead as gethostname() on that OS version will always return "localhost.local" (for privacy reasons), so in conclusio the lookup will always fail.
RTSP can involve multicast UDP content, but does not require to have it. This depends on stream and server configuration. So, if you have multicast content, yes, then you need the entitlement. If you are doing UDP unicast, then, no.
I have just sent you an email containing a RTSP URL that you'll be able to use for testing, and that is showing the delay reliably. It's from a Foscam FI9900P camera from a few years ago, but I'm also seeing the issue with some Hikvisions, TP-Link Tapo C200/210 and one Eufy camera (so, each camera I could test with).
Since my app is a generic RTSP player and can therefore deal with any kind of camera, I have applied for the multicast entitlement. I will report back when (if) it is granted, both if there are or aren't changes with this issue; thank you also for the very clear details you provided about this.
You can check the different VLC library versions as a workaround. For me, both the 3.5.1 and 3.6.0b4 versions are running extremely slowly, and I've experimented with several different VLC versions.
You might want to give version 3.3.0 a try. Although you may still encounter the message "Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0," it will be thrown asynchronously a couple of times, and you won't need to wait for it.
It's still not a good solution to lock the version, because some of my customers are facing this delay, but at least you can try. Please let me know if this proves helpful! :)
@fkuehne, please let us know if we should request multicast entitlement to resolve this issue or if there are any scheduled fixes in place for it.
I will try compiling version 3.3.0 and report back .
In the meantime, I've also tried initialising the mediaPlayer with the "--rtsp-tcp" option, but it didn't improve the delay, and the Unable to determine our source address is still logged.
This last experiment makes me wonder about the multicast entitlement, because my understanding (which might be wrong) from the post on Apple's forums I linked earlier was that it might be necessary for UDP traffic, but if the issue is still there when streaming TCP packets...
Apple has just granted my request for the com.apple.developer.networking.multicast special entitlement and I am happy to report that adding such managed Multicast entitlement to my app made the logged message go away, and most importantly drove the delay in playing RTSP on device down to basically zero (sub-1 second for loading a 1080p stream in WiFi or with medium-signal 5G...), just as my prototype app was behaving in the Simulator.
At the moment I can only test on my iPhone (12 Pro running iOS 17.0.2) and on my iPad 10th gen (iPadOS 17.0.2), so my exceptionally positive experience is not a guarantee of equal results on previous versions of the operating systems, or with different devices (or compiling with Xcode versions older than 15.0).
But! It's hard for me to imagine that this dramatic change is a coincidence, so my suggestion for @Z1napp and for everyone else experiencing the delay is to apply for the entitlement.
Obviously, this is not my issue to close, but if Vadym's experience will match mine, I think this might be consider resolved.
Hope this helps, have a great week-end (mine certainly just got a lot better!) and a special thanks to @fkuehne (this is becoming an habit for me ;)!
Good morning, @cdf1982 ! I'm glad to hear that the issue has been resolved on your end :)
Yesterday, some of my customers and the support team updated to iOS 17, and unfortunately, the delay increased from 1 second to 30 seconds. I updated my device as well and experienced the same result.
I will attempt to request this entitlement, and I'm hopeful it will help. Thank you for your feedback!
@cdf1982 Good afternoon!
Could you please contact me by email (aiozz@hotmail.com)? I have a question regarding this multicast property and I would like to ask it personally if you don't mind :)
The problem Unable to determine our source address: This computer has an invalid IP address: 0.0.0.0 is gone after adding the multicast entitlement. Thank you all for the participation!