mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
Hold owner lock when changing codecs
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -4948,11 +4948,21 @@ retryowner:
|
|||||||
iaxs[fr.callno]->owner->nativeformats = iaxs[fr.callno]->peerformat;
|
iaxs[fr.callno]->owner->nativeformats = iaxs[fr.callno]->peerformat;
|
||||||
if (option_verbose > 2)
|
if (option_verbose > 2)
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "Format for call is %s\n", ast_getformatname(iaxs[fr.callno]->owner->nativeformats));
|
ast_verbose(VERBOSE_PREFIX_3 "Format for call is %s\n", ast_getformatname(iaxs[fr.callno]->owner->nativeformats));
|
||||||
/* Setup read/write formats properly. */
|
retryowner2:
|
||||||
if (iaxs[fr.callno]->owner->writeformat)
|
if (ast_mutex_trylock(&iaxs[fr.callno]->owner->lock)) {
|
||||||
ast_set_write_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->writeformat);
|
ast_mutex_unlock(&iaxsl[fr.callno]);
|
||||||
if (iaxs[fr.callno]->owner->readformat)
|
usleep(1);
|
||||||
ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat);
|
ast_mutex_lock(&iaxsl[fr.callno]);
|
||||||
|
if (iaxs[fr.callno] && iaxs[fr.callno]->owner) goto retryowner2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iaxs[fr.callno] && iaxs[fr.callno]->owner) {
|
||||||
|
/* Setup read/write formats properly. */
|
||||||
|
if (iaxs[fr.callno]->owner->writeformat)
|
||||||
|
ast_set_write_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->writeformat);
|
||||||
|
if (iaxs[fr.callno]->owner->readformat)
|
||||||
|
ast_set_read_format(iaxs[fr.callno]->owner, iaxs[fr.callno]->owner->readformat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast_mutex_lock(&dpcache_lock);
|
ast_mutex_lock(&dpcache_lock);
|
||||||
|
Reference in New Issue
Block a user