Review Board 1.7.16

Fix problems when RTP packet frame size is changed

Review Request #184 - Created March 4, 2009 and submitted

Kevin Fleming
During some code analysis, I found that calling ast_rtp_codec_setpref() on an ast_rtp session does not work as expected; it does not adjust the smoother that may on the RTP session, in fact it summarily drops it, even if it has data in it, even if the current format's framing size has not changed. This is not good.

This patch changes this behavior, so that if the packetization size for the current format changes, any existing smoother is safely updated to use the new size, and if no smoother was present, one is created. A new API call for smoothers, ast_smoother_reconfigure(), was required to implement these changes.
Compile testing only.
Review request changed
Updated (March 5, 2009, 3:19 a.m.)
Added optimization per Josh's suggestion.
Ship it!
Posted (March 5, 2009, 4:49 a.m.)
Other than picky formatting comments, this looks sane to me.
/branches/1.4/include/asterisk/frame.h (Diff revision 3)
I know the entire smoother API is not documented, but it would really awesome to have documentation for the new API call.  :-)
/branches/1.4/main/frame.c (Diff revision 3)
Minor formatting complaints ... (even though I know this code was moved from somewhere else)

The coding guidelines now recommend always using braces.  Also, there is one place missing some spaces: s->data+s->len
/branches/1.4/main/frame.c (Diff revision 3)
I'm going to be a formatting nazi again.  Almost all places in Asterisk where we have multi-line comments, they are in the form:

 * stuff
 * and things
 * moo
/branches/1.4/main/frame.c (Diff revision 3)
'!!' is cool and all, but I wonder if "swap ? 1 : 0" would be more clear. runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to