]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_asterisk: Fix 100% CPU usage due to timer heap thread spinning.
authorJoshua Colp <jcolp@digium.com>
Tue, 16 Sep 2014 21:01:38 +0000 (21:01 +0000)
committerJoshua Colp <jcolp@digium.com>
Tue, 16 Sep 2014 21:01:38 +0000 (21:01 +0000)
Side note: I need a vacation.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@423210 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_rtp_asterisk.c

index a6210060998b0c279b260d0420f7aa588d04ebfe..ae69715c2821a691a517cc11179e17e265df7720 100644 (file)
@@ -1029,7 +1029,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;
        }
 
@@ -1683,8 +1683,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;