[FFmpeg-devel] [PATCH] UDP hangs with no input data

Jindrich Makovicka makovick
Thu Nov 13 10:31:48 CET 2008


On Wed, Nov 12, 2008 at 21:33, Michael Niedermayer <michaelni at gmx.at> wrote:
> [...]
>> @@ -426,6 +427,11 @@
>>           * avoid losing data on OSes that set this too low by default. */
>>          tmp = UDP_MAX_PKT_SIZE;
>>          setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp));
>> +        tv.tv_sec = 0;
>> +        tv.tv_usec = 100 * 1000;
>> +        if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
>
> posix says "Note that not all implementations allow this option to be set."
> i dont know how relevant this is ...
>
> [...]
>
>> @@ -448,6 +454,8 @@
>>              if (ff_neterrno() != FF_NETERROR(EAGAIN) &&
>>                  ff_neterrno() != FF_NETERROR(EINTR))
>>                  return AVERROR(EIO);
>> +            if (url_interrupt_cb())
>> +                return AVERROR(EINTR);
>>          } else {
>>              break;
>>          }
>
> that looks ok

Here is an alternate version using select() to be on the safe side.

-- 
Jindrich Makovicka
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: udp.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081113/1932bb17/attachment.asc>



More information about the ffmpeg-devel mailing list