[asterisk-dev] [Code Review] 2894: rtp_engine: ast_rtp_instance_early_bridge_make_compatible confusion over copy direction caused loss of rtp codec payloads

Scott Griepentrog reviewboard at asterisk.org
Tue Oct 22 11:36:13 CDT 2013



> On Oct. 22, 2013, 10:31 a.m., Matt Jordan wrote:
> > /branches/1.8/main/rtp_engine.c, line 1467
> > <https://reviewboard.asterisk.org/r/2894/diff/1/?file=46940#file46940line1467>
> >
> >     Just to double check the logic change here:
> >     
> >     Noting that ast_rtp_codecs_payloads_copy has the following signature:
> >     
> >     void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance);
> >     
> >     The original method calls copies the codecs from instance0 to instance1.
> >     
> >     In your updated version, instance0 in the destination; instance1 is the source.
> >     
> >     So the method cal now copies the codecs from the source (instance1) to the destination (instance0).
> >     
> >     Is this what fixed the payload copy issue?

Yes.  It would be possible to drop the other cosmetic/clarity changes and just reverse the arguments to the payloads_copy and resolve the issue.

In other places in asterisk, make_compatible means a two way process of copying in either direction.  In this function, the name nor the arguments clearly indicate that there is a basic one way copy operation being performed, which made it easy to accidentally reverse the arguments and difficult to spot later.  Renaming the instance 0/1 to show source/dest helps readability for this function, and there are others that could benefit from the same.


- Scott


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2894/#review9974
-----------------------------------------------------------


On Sept. 30, 2013, 6:02 p.m., Scott Griepentrog wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2894/
> -----------------------------------------------------------
> 
> (Updated Sept. 30, 2013, 6:02 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-21464
>     https://issues.asterisk.org/jira/browse/ASTERISK-21464
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Testing for Issue 21464 (thanks Kevin!) turned up some odd behavior on codec negotiation, including loss of codec payloads.  The arguments to ast_rtp_instance_early_bridge_make_compatible were not clearly indicating source and destination channel for the copy of codecs, which made it non-obvious that the arguments to ast_rtp_codecs_payloads_copy() were reversed.  The result is that an offer containing 119 telephone event would be converted to 101 telephone event, for both directrtpsetup=yes and no.
> 
> 
> Diffs
> -----
> 
>   /branches/1.8/include/asterisk/rtp_engine.h 400206 
>   /branches/1.8/main/rtp_engine.c 400206 
> 
> Diff: https://reviewboard.asterisk.org/r/2894/diff/
> 
> 
> Testing
> -------
> 
> Tested with 1.8 to prove that telephone-event payload code 119 is now being passed again (as it was in Asterisk versions prior to 1.8).
> 
> 
> Thanks,
> 
> Scott Griepentrog
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20131022/c5d588eb/attachment-0001.html>


More information about the asterisk-dev mailing list