Make read/write mode have a lock parameter and use it properly.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2572 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-03-27 06:50:12 +00:00
parent 4b4c55e328
commit eeb2ca5b26
25 changed files with 89 additions and 76 deletions

View File

@@ -137,13 +137,13 @@ static struct agent_pvt {
/* Native formats changed, reset things */ \
ast->nativeformats = p->chan->nativeformats; \
ast_log(LOG_DEBUG, "Resetting read to %d and write to %d\n", ast->readformat, ast->writeformat);\
ast_set_read_format(ast, ast->readformat); \
ast_set_write_format(ast, ast->writeformat); \
ast_set_read_format(ast, ast->readformat, 0); \
ast_set_write_format(ast, ast->writeformat, 0); \
} \
if (p->chan->readformat != ast->pvt->rawreadformat) \
ast_set_read_format(p->chan, ast->pvt->rawreadformat); \
ast_set_read_format(p->chan, ast->pvt->rawreadformat, 0); \
if (p->chan->writeformat != ast->pvt->rawwriteformat) \
ast_set_write_format(p->chan, ast->pvt->rawwriteformat); \
ast_set_write_format(p->chan, ast->pvt->rawwriteformat, 0); \
} \
} while(0)
@@ -464,7 +464,7 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
ast_log( LOG_DEBUG, "Waited for stream, result '%d'\n", res);
}
if (!res) {
res = ast_set_read_format(p->chan, ast_best_codec(p->chan->nativeformats));
res = ast_set_read_format(p->chan, ast_best_codec(p->chan->nativeformats), 0);
ast_log( LOG_DEBUG, "Set read format, result '%d'\n", res);
if (res)
ast_log(LOG_WARNING, "Unable to set read format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats)));
@@ -474,7 +474,7 @@ static int agent_call(struct ast_channel *ast, char *dest, int timeout)
}
if (!res) {
ast_set_write_format(p->chan, ast_best_codec(p->chan->nativeformats));
ast_set_write_format(p->chan, ast_best_codec(p->chan->nativeformats), 0);
ast_log( LOG_DEBUG, "Set write format, result '%d'\n", res);
if (res)
ast_log(LOG_WARNING, "Unable to set write format to %s\n", ast_getformatname(ast_best_codec(p->chan->nativeformats)));
@@ -1261,12 +1261,12 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode)
ast_mutex_lock(&agentlock);
ast_mutex_lock(&p->lock);
if (!res) {
res = ast_set_read_format(chan, ast_best_codec(chan->nativeformats));
res = ast_set_read_format(chan, ast_best_codec(chan->nativeformats), 0);
if (res)
ast_log(LOG_WARNING, "Unable to set read format to %d\n", ast_best_codec(chan->nativeformats));
}
if (!res) {
ast_set_write_format(chan, ast_best_codec(chan->nativeformats));
ast_set_write_format(chan, ast_best_codec(chan->nativeformats), 0);
if (res)
ast_log(LOG_WARNING, "Unable to set write format to %d\n", ast_best_codec(chan->nativeformats));
}