Review Board 1.7.16

translate.c: Only select audio codecs to determine the best translation choice.

Review Request #4605 - Created April 8, 2015 and submitted

Given a source capability of h264 and ulaw, a destination capability of
h264 and g722 then ast_translator_best_choice() would pick h264 as the
best choice even though h264 is a video codec and Asterisk only supports
translation of audio codecs.  When the audio starts flowing, there are
warnings about a codec mismatch when the channel tries to write a frame to
the peer.

* Made ast_translator_best_choice() only select audio codecs.

* Restore a check in channel.c:set_format() lost after v1.8 to prevent
trying to set a non-audio codec.

This is an intermediate patch for a series of patches aimed at improving
translation path choices for ASTERISK-24841.

This patch is a complete enough fix for ASTERISK-21777 as the v11 version
of ast_translator_best_choice() does the same thing.  However, chan_sip.c
still somehow tries to call ast_codec_choose() which then calls
ast_best_codec() with a capability set that doesn't contain any audio
formats for the incoming call.  The remaining warning message seems to be
a benign transient.
Modified chan_pjsip.c:chan_pjsip_new() to force inclusion of the h264
video codec in the native capabilities.  Without the patch I get the path
translation warnings.  With the patch I don't get the warnings.
Review request changed
Updated (April 10, 2015, 7:23 p.m.)
  • changed from pending to submitted
Committed in revision 434687 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