mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-06 05:02:29 +00:00
Add channel lock protection around translation path setup.
Most callers of ast_channel_make_compatible() happen before the channels enter a two party bridge. With the new bridging framework, two party bridging technologies may also call ast_channel_make_compatible() when there is more than one thread involved with the two channels. * Added channel lock protection in set_format() and ast_channel_make_compatible_helper() when dealing with the channel's native formats while setting up a translation path. * Fixed best_src_fmt and best_dst_fmt usage consistency in ast_channel_make_compatible_helper(). The call to ast_translator_best_choice() got them backwards. * Updated some callers of ast_channel_make_compatible() and the function documentation. There is actually a difference between the two channels passed in. * Fixed the deadlock potential in res_fax.c dealing with ast_channel_make_compatible(). The deadlock potential was already there anyway because res_fax called ast_channel_make_compatible() with chan locked. (closes issue ASTERISK-22542) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2915/ ........ Merged revisions 401239 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401240 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1984,14 +1984,23 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Makes two channel formats compatible
|
||||
* \param c0 first channel to make compatible
|
||||
* \param c1 other channel to make compatible
|
||||
* \brief Make the frame formats of two channels compatible.
|
||||
*
|
||||
* \param chan First channel to make compatible. Should be the calling party.
|
||||
* \param peer Other channel to make compatible. Should be the called party.
|
||||
*
|
||||
* \note Absolutely _NO_ channel locks should be held before calling this function.
|
||||
*
|
||||
* \details
|
||||
* Set two channels to compatible formats -- call before ast_channel_bridge in general.
|
||||
* \return Returns 0 on success and -1 if it could not be done
|
||||
* Set two channels to compatible frame formats in both
|
||||
* directions. The path from peer to chan is made compatible
|
||||
* first to allow for in-band audio in case the other direction
|
||||
* cannot be made compatible.
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval -1 on error.
|
||||
*/
|
||||
int ast_channel_make_compatible(struct ast_channel *c0, struct ast_channel *c1);
|
||||
int ast_channel_make_compatible(struct ast_channel *chan, struct ast_channel *peer);
|
||||
|
||||
/*!
|
||||
* \brief Bridge two channels together (early)
|
||||
|
Reference in New Issue
Block a user