[Home]

Summary:ASTERISK-04217: [patch] new jb - prevent excess scheduling work
Reporter:grolloj (grolloj)Labels:
Date Opened:2005-05-18 11:43:56Date Closed:2011-06-07 14:10:13
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_iax2
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) del_extra_sched.2.patch.txt
( 1) del_extra_sched.patch.txt
Description:update_jbsched is being called too frequently in chan_iax2. This function is being called each time a frame is added or removed from the jitterbuffer. The function will check when the next frame should be removed (via jb_next) and schedule the next jb_get call. If a call is already scheduled, it first removes it.

The vast majority of the time though, after a jb_put, there's no need to reschedule the next jb_get. Only if the put inserted the frame at the head of the queue will the return from jb_next change, requiring a rescheduling.

This patch adds a return value from jb_put which indicates whether the last call to jb_next remains valid. update_jbsched will only be called as often as necessary, reducing the unnecessary calls to ast_sched_del and ast_sched_add.

****** ADDITIONAL INFORMATION ******

Disclaimer on file

Added some logging to update_jbsched and get_from_jb in chan_iax2 to show the problem:

without the patch:

May 18 10:51:54 WARNING[1550] chan_iax2.c: update_jbsched
May 18 10:51:54 WARNING[1550] chan_iax2.c: update_jbsched
May 18 10:51:54 WARNING[1550] chan_iax2.c: get_from_jb
May 18 10:51:54 WARNING[1550] chan_iax2.c: update_jbsched
May 18 10:51:54 WARNING[1550] chan_iax2.c: get_from_jb
May 18 10:51:54 WARNING[1550] chan_iax2.c: update_jbsched
May 18 10:51:54 WARNING[1550] chan_iax2.c: update_jbsched
May 18 10:51:54 WARNING[1550] chan_iax2.c: get_from_jb
May 18 10:51:54 WARNING[1550] chan_iax2.c: update_jbsched
...


with the patch:

May 18 10:55:02 WARNING[5639] chan_iax2.c: update_jbsched
May 18 10:55:02 WARNING[5639] chan_iax2.c: get_from_jb
May 18 10:55:02 WARNING[5639] chan_iax2.c: update_jbsched
May 18 10:55:02 WARNING[5639] chan_iax2.c: get_from_jb
May 18 10:55:02 WARNING[5639] chan_iax2.c: update_jbsched
May 18 10:55:02 WARNING[5639] chan_iax2.c: get_from_jb
May 18 10:55:02 WARNING[5639] chan_iax2.c: update_jbsched
May 18 10:55:02 WARNING[5639] chan_iax2.c: get_from_jb
May 18 10:55:02 WARNING[5639] chan_iax2.c: update_jbsched

Comments:By: Mark Spencer (markster) 2005-05-18 21:19:05

Added to CVS, is this ever going to end? *G*

By: Digium Subversion (svnbot) 2008-01-15 15:35:24.000-0600

Repository: asterisk
Revision: 5722

U   trunk/channels/chan_iax2.c
U   trunk/jitterbuf.c
U   trunk/jitterbuf.h

------------------------------------------------------------------------
r5722 | markster | 2008-01-15 15:35:23 -0600 (Tue, 15 Jan 2008) | 2 lines

Yet another set of jitter buffer changes (this time some scheduling improvements) (bug ASTERISK-4217)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=5722