[Freeswitch-dev] switch_poll time out value is not honored
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:100000c19d3aa-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
what exactly are you trying to accomplish by not using the timers?
On Apr 17, 2018, at 10:07 PM, kaiduan xie <kaiduanx@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
set rtp_timer_name=none to disable timer in RTP On Wed, Apr 18, 2018 at 4:00 PM, Michael Jerris <mike@jerris.com> wrote:
what exactly are you trying to accomplish by not using the timers?
On Apr 17, 2018, at 10:07 PM, kaiduan xie <kaiduanx@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
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
-- Anthony Minessale II Founder, FreeSWITCH. http://freeswitch.com https://youtu.be/l_hOxzCt6X4 https://www.youtube.com/watch?v=oAxXgyx5jUw https://www.youtube.com/watch?v=9XXgW34t40s https://www.youtube.com/watch?v=NLaDpGQuZDA
Thank you Michael and Anthony for the help. I am trying to add multiple SSRC support in FreeSwitch to normal bridged call to support Jitsi and FreeSwitch integration. For example, there is a call between a webrtc participant and a SIP phone, the call is a bridged call in FreeSwitch. And later on a new webrtc participant joins Jitsi video bridge, and the second SSRC shows up in the call leg A in FreeSwitch. The idea is to covert the bridged call to conference call whenever a new SSRC shows up in a bridged call, for each SSRC, a conference member is created. For the original call leg, RTP reading is switched from timer to poll reading, and I would like to reduce the poll time out value to make reading from network more frequently. Now the above weird behaviour bugged me, the poll time out value is not honored. Any input is welcome and I plan contribute back the work to the community. Thanks, /Kaiduan On Wednesday, April 18, 2018, 5:49:05 p.m. EDT, Anthony Minessale <anthony.minessale@gmail.com> wrote: set rtp_timer_name=none to disable timer in RTP On Wed, Apr 18, 2018 at 4:00 PM, Michael Jerris <mike@jerris.com> wrote: what exactly are you trying to accomplish by not using the timers? On Apr 17, 2018, at 10:07 PM, kaiduan xie <kaiduanx@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:100000c19d3aa-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 ______________________________ ______________________________ _____________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www. freeswitchsolutions.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-dev mailing list FreeSWITCH-dev@lists. freeswitch.org http://lists.freeswitch.org/ mailman/listinfo/freeswitch- dev UNSUBSCRIBE:http://lists. freeswitch.org/mailman/ options/freeswitch-dev http://www.freeswitch.org -- Anthony Minessale IIFounder, FreeSWITCH.http://freeswitch.com https://youtu.be/l_hOxzCt6X4 https://www.youtube.com/watch?v=oAxXgyx5jUw https://www.youtube.com/watch?v=9XXgW34t40shttps://www.youtube.com/watch?v=N... _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com FreeSWITCH-dev mailing list FreeSWITCH-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
participants (3)
-
Anthony Minessale
-
kaiduan xie
-
Michael Jerris