[FFmpeg-devel] [RFC] switch to poll()

Luca Barbato lu_zero
Sun Nov 14 19:00:18 CET 2010


On 11/14/2010 06:35 PM, Ronald S. Bultje wrote:
> Hi,
> 
> On Sun, Nov 14, 2010 at 5:22 PM, Luca Barbato <lu_zero at gentoo.org> wrote:
>> On 11/14/2010 12:22 PM, Luca Barbato wrote:
>>> The only place in which we risk to add more code is rtsp, now I'm trying
>>> to figure out a saner way to check there.
>>
>> Gave up trying to go to the saner route first.
> [..]
>> --- a/libavformat/rtsp.c
>> +++ b/libavformat/rtsp.c
>> @@ -1439,55 +1439,55 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
>>  {
>>      RTSPState *rt = s->priv_data;
>>      RTSPStream *rtsp_st;
>> -    fd_set rfds;
>> -    int fd, fd_rtcp, fd_max, n, i, ret, tcp_fd, timeout_cnt = 0;
>> -    struct timeval tv;
>> -
>> +    int fd, fd_rtcp, n, i, ret, tcp_fd, timeout_cnt = 0;
>> +    int max_p = 0;
>> +    //FIXME use malloc
>> +    struct pollfd p[2*rt->nb_rtsp_streams+1];
> 
> Indeed.

Exactly =)

> int j = 1 - (tcp_fd == -1);
> for (i = 0; i < rt->nb_rtsp_streams; i++) {
>     if (rtsp_st->rtp_handle) {
>         if (p[j].revents & POLLIN) /* rtp fd */ ||
>             p[j+1].revents & POLLIN) /* rtcp fd */) {
>             ..
>         }
>         j += 2;
>     }
> }
> 
> Right?

pretty much.

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero




More information about the ffmpeg-devel mailing list