diff options
author | Joshua Colp <jcolp@digium.com> | 2014-09-16 21:03:59 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2014-09-16 21:03:59 +0000 |
commit | 85d7e441863f09edd3cc54a241e6cb272f8d91ce (patch) | |
tree | f57722222041e5f1178750011854e8d9ae7e2b8f /res/res_rtp_asterisk.c | |
parent | 93f7c8a434e19649d0c9b2c433ae8409d98dfc05 (diff) |
res_rtp_asterisk: Fix 100% CPU usage due to timer heap thread spinning.
Side note: I need a vacation.
........
Merged revisions 423210 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 423211 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@423212 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_rtp_asterisk.c')
-rw-r--r-- | res/res_rtp_asterisk.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c index 095e29141..dc5a2a71e 100644 --- a/res/res_rtp_asterisk.c +++ b/res/res_rtp_asterisk.c @@ -1031,7 +1031,7 @@ static struct ast_rtp_ioqueue_thread *rtp_ioqueue_thread_get_or_create(void) pj_timer_heap_set_lock(ioqueue->timerheap, lock, PJ_TRUE); - if (pj_ioqueue_create(ioqueue->pool, 16, &ioqueue->ioqueue) != PJ_SUCCESS) { + if (pj_ioqueue_create(ioqueue->pool, PJ_IOQUEUE_MAX_HANDLES, &ioqueue->ioqueue) != PJ_SUCCESS) { goto fatal; } @@ -1700,8 +1700,17 @@ static pj_ice_sess_cb ast_rtp_ice_sess_cb = { /*! \brief Worker thread for timerheap */ static int timer_worker_thread(void *data) { + pj_ioqueue_t *ioqueue; + + if (pj_ioqueue_create(pool, 1, &ioqueue) != PJ_SUCCESS) { + return -1; + } + while (!timer_terminate) { + const pj_time_val delay = {0, 10}; + pj_timer_heap_poll(timer_heap, NULL); + pj_ioqueue_poll(ioqueue, &delay); } return 0; |