[Live-devel] Can't play RTSP streams on some Android devices (LibVLC). "setsockopt(SO_REUSEPORT) error: Protocol not available"
Mirco Pazzaglia
mirco.pazzaglia at inim.biz
Fri Dec 20 01:31:48 PST 2019
Hello,
As far as I know LibVLC is currently using Live555 (2016.11.28) as its RT(S)P plugin. It works fine on most Android devices nowadays, however I have some issues with some of them, I get the following error:
"libvlc demux: RTP subsession 'audio/MPEG4-GENERIC' failed (getsockname() error: Bad file descriptor)".
Digging up both in the VLC and in the Live555 source code I was able to find the real cause of the issue: "setsockopt(SO_REUSEPORT) error: Protocol not available". The error is generated by the "setsockopt(newSocket, SOL_SOCKET, SO_REUSEPORT, (const char*)&reuseFlag, sizeof reuseFlag)" in GroupsockHelper.cpp. In fact, it seems that some other (VLC ?) code provides the define for the SO_REUSEPORT which in turns tells the preprocessor to include that setsockopt. By reading this https://mirrors.edge.kernel.org/pub/linux/kernel/projects/backports/stable/v3.9-rc1/ChangeLog-3.9-rc1-3 I get that SO_REUSEPORT was introduced as of kernel version 3.9-rc1. In fact, Android devices with kernel version lower than that cannot play RTSP stream. I have already posted this same issue over at the Videolan tracking system https://trac.videolan.org/vlc/ticket/23201#comment:5 (for more details head over there) and over https://code.videolan.org/videolan/LibVLCSharp/issues/226 .
I am not entirely sure if this should be fixed in the Live555 code or in the VLC one, sorry if I was not supposed to post it over here. In fact, I suspect it is more of a VLC-related issue (since it was working with libvlc v.3.0.0 and not in v3.2.0 even though, if I am not mistaken, they both ship the same Live555 plugin version but I am not entirely sure).
Thank you.
More information about the live-devel
mailing list