[Freeswitch-dev] switch_poll time out value is not honored

Michael Jerris mike at jerris.com
Wed Apr 18 21:00:28 UTC 2018


what exactly are you trying to accomplish by not using the timers?


> On Apr 17, 2018, at 10:07 PM, kaiduan xie <kaiduanx at yahoo.ca> wrote:
> 
> Hi,
> 
> For my application, I made some changes in switch_rtp to use poll to read from network instead of synchronising on timer,
> 
> switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
> 
> I observed a weird behaviour with regarding to switch_poll, it blocks with 20ms always even the timer value is 10 ms when there are no packet received on network.
> 
> +                               pt = 10 * 1000; // 10ms
> +                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "+poll reading:%d\n", pt);
>                         }
>  
>                         poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt);
> +                      switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "-poll reading:%d:%d\n", pt, poll_status);
> 
> The following is from the log,
> 
> 0c19d3aa-429e-11e8-bbd0-fb8396b8383d 2018-04-17 20:21:31.453604 [DEBUG] [23807] switch_rtp.c:7001 +poll reading:10000
> 0c19d3aa-429e-11e8-bbd0-fb8396b8383d 2018-04-17 20:21:31.473649 [DEBUG] [23807] switch_rtp.c:7005 -poll reading:10000:2
> 
> Any idea? This is really weird, I expect switch_poll works as select.
> 
> Many thanks for help.
> 
> /Kaiduan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20180418/5f813008/attachment.html>


More information about the FreeSWITCH-dev mailing list