Skip to content
Snippets Groups Projects
Commit 08460fc0 authored by David Vossel's avatar David Vossel
Browse files

Fixes bug in chan_sip where nativeformats are not set correctly.

The nativeformats field was being overwritten when it should have been
appended too.  This caused some format capabilities to be lost briefly and
some log warnings to be output.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@307433 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 707cf78c
No related branches found
No related tags found
No related merge requests found
......@@ -8881,8 +8881,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
ast_codec_choose(&p->prefs, p->jointcaps, 1, &tmp_fmt);
 
ast_format_cap_set(p->owner->nativeformats, &tmp_fmt);
ast_format_cap_joint_copy(p->caps, vpeercapability, p->owner->nativeformats);
ast_format_cap_joint_copy(p->caps, tpeercapability, p->owner->nativeformats);
ast_format_cap_joint_append(p->caps, vpeercapability, p->owner->nativeformats);
ast_format_cap_joint_append(p->caps, tpeercapability, p->owner->nativeformats);
 
ast_set_read_format(p->owner, &p->owner->readformat);
ast_set_write_format(p->owner, &p->owner->writeformat);
......
......@@ -191,6 +191,14 @@ struct ast_format_cap *ast_format_cap_joint(const struct ast_format_cap *cap1, c
*/
int ast_format_cap_joint_copy(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result);
/*!
* \brief Get joint capability structure, append into result capabilities structure
*
* \retval 1, joint capabilities exist
* \retval 0, joint capabilities do not exist
*/
int ast_format_cap_joint_append(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result);
/*!
* \brief Find out if capability structures have any joint capabilities without
* returning those capabilities.
......
......@@ -409,7 +409,7 @@ struct ast_format_cap *ast_format_cap_joint(const struct ast_format_cap *cap1, c
return NULL;
}
int ast_format_cap_joint_copy(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result)
static int joint_copy_helper(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result, int append)
{
struct ao2_iterator it;
struct ast_format *tmp;
......@@ -417,8 +417,9 @@ int ast_format_cap_joint_copy(const struct ast_format_cap *cap1, const struct as
.joint_cap = result,
.joint_found = 0,
};
ast_format_cap_remove_all(result);
if (!append) {
ast_format_cap_remove_all(result);
}
it = ao2_iterator_init(cap1->formats, cap2->nolock ? AO2_ITERATOR_DONTLOCK : 0);
while ((tmp = ao2_iterator_next(&it))) {
data.format = tmp;
......@@ -433,6 +434,16 @@ int ast_format_cap_joint_copy(const struct ast_format_cap *cap1, const struct as
return ao2_container_count(result->formats) ? 1 : 0;
}
int ast_format_cap_joint_append(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result)
{
return joint_copy_helper(cap1, cap2, result, 1);
}
int ast_format_cap_joint_copy(const struct ast_format_cap *cap1, const struct ast_format_cap *cap2, struct ast_format_cap *result)
{
return joint_copy_helper(cap1, cap2, result, 0);
}
struct ast_format_cap *ast_format_cap_get_type(const struct ast_format_cap *cap, enum ast_format_type ftype)
{
struct ao2_iterator it;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment