Hi all,
I'm working on an application to display multiple RTSP multicast streams
at the same time. The app runs a thread for each stream, each thread
doing it's own libav-thingy.
I'm developing on linux, on which everything works just fine, but today
I found out the windows build was having problems setting up the
streams in some cases, resulting in av_open_input_file() returning
AVERROR_INVALIDDATA.
After some time of digging in the libavformat source, I think I have
tracked the problem down to windows using local UDP port numbers in te
same range as the video happens to be streaming from my video server:
50000 and up.
I'm opening the stream by passing the url
(rtsp://192.168.1.223/mpeg4/1/media.amp?multicast)
to av_open_input_file(). In the resulting RTSP handshake the video
server (an Axis 241Q video encoder) assigns the port number 50000 to
to the RTP video stream.
Somewhere down inside libavformat the socket for listening in on the
multicast traffic is opened with the udp_open() function. Here the
socket is created, and bound to the given port:
if (s->is_multicast && !(h->flags & URL_WRONLY)) {
bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
When this fails, a bind is retried on the local port:
bind(udp_fd,(struct sockaddr *)&my_addr, len);
Now things start breaking: because the given port happens to be taken by
one of the already open sockets that is assigned the same *local* port
number by windows (which can be the same UDP socket), the bind fails,
resulting in the AVERROR_INVALIDDATA upstairs in the av_open_input_file() call.
The workaround is simple: just configure the video server to use a
different port range, and the poroblem is gone.
Still wondering, though: Did I diagnose this problem right, and are
these kind of problems to be expected ? Is it my personal task as
network configurator to avoid this and choose the proper port ranges, or
is this something that should/could be handled in libav* ?
Thanks,
Ico
--
:wq
^X^Cy^K^X^C^C^C^C
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user