mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +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;
|
||||
if (option_verbose > 2)
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Format for call is %s\n", ast_getformatname(iaxs[fr.callno]->owner->nativeformats));
|
||||
/* 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);
|
||||
retryowner2:
|
||||
if (ast_mutex_trylock(&iaxs[fr.callno]->owner->lock)) {
|
||||
ast_mutex_unlock(&iaxsl[fr.callno]);
|
||||
usleep(1);
|
||||
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);
|
||||
|
Reference in New Issue
Block a user