mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 02:26:23 +00:00
Fixup read/write locking
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2573 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -113,7 +113,7 @@ static int ices_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
oreadformat = chan->readformat;
|
oreadformat = chan->readformat;
|
||||||
res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
|
res = ast_set_read_format(chan, AST_FORMAT_SLINEAR, 0);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
close(fds[1]);
|
close(fds[1]);
|
||||||
@@ -164,7 +164,7 @@ static int ices_exec(struct ast_channel *chan, void *data)
|
|||||||
if (pid > -1)
|
if (pid > -1)
|
||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
if (!res && oreadformat)
|
if (!res && oreadformat)
|
||||||
ast_set_read_format(chan, oreadformat);
|
ast_set_read_format(chan, oreadformat, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -109,7 +109,7 @@ static int NBScat_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_stopstream(chan);
|
ast_stopstream(chan);
|
||||||
|
|
||||||
owriteformat = chan->writeformat;
|
owriteformat = chan->writeformat;
|
||||||
res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
|
res = ast_set_write_format(chan, AST_FORMAT_SLINEAR, 0);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
|
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -173,7 +173,7 @@ static int NBScat_exec(struct ast_channel *chan, void *data)
|
|||||||
if (pid > -1)
|
if (pid > -1)
|
||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
if (!res && owriteformat)
|
if (!res && owriteformat)
|
||||||
ast_set_write_format(chan, owriteformat);
|
ast_set_write_format(chan, owriteformat, 0);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
channel.c
15
channel.c
@@ -1505,7 +1505,8 @@ int ast_set_write_format(struct ast_channel *chan, int fmts, int needlock)
|
|||||||
int native;
|
int native;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
ast_mutex_lock(&chan->lock);
|
if (needlock)
|
||||||
|
ast_mutex_lock(&chan->lock);
|
||||||
native = chan->nativeformats;
|
native = chan->nativeformats;
|
||||||
fmt = fmts;
|
fmt = fmts;
|
||||||
|
|
||||||
@@ -1513,7 +1514,8 @@ int ast_set_write_format(struct ast_channel *chan, int fmts, int needlock)
|
|||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
|
ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
|
||||||
ast_getformatname(fmts), ast_getformatname(chan->nativeformats));
|
ast_getformatname(fmts), ast_getformatname(chan->nativeformats));
|
||||||
ast_mutex_unlock(&chan->lock);
|
if (needlock)
|
||||||
|
ast_mutex_unlock(&chan->lock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1528,7 +1530,8 @@ int ast_set_write_format(struct ast_channel *chan, int fmts, int needlock)
|
|||||||
chan->pvt->writetrans = ast_translator_build_path(chan->pvt->rawwriteformat, chan->writeformat);
|
chan->pvt->writetrans = ast_translator_build_path(chan->pvt->rawwriteformat, chan->writeformat);
|
||||||
if (option_debug)
|
if (option_debug)
|
||||||
ast_log(LOG_DEBUG, "Set channel %s to write format %s\n", chan->name, ast_getformatname(chan->writeformat));
|
ast_log(LOG_DEBUG, "Set channel %s to write format %s\n", chan->name, ast_getformatname(chan->writeformat));
|
||||||
ast_mutex_unlock(&chan->lock);
|
if (needlock)
|
||||||
|
ast_mutex_unlock(&chan->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1547,7 +1550,8 @@ int ast_set_read_format(struct ast_channel *chan, int fmts, int needlock)
|
|||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
|
ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
|
||||||
ast_getformatname(chan->nativeformats), ast_getformatname(fmts));
|
ast_getformatname(chan->nativeformats), ast_getformatname(fmts));
|
||||||
ast_mutex_unlock(&chan->lock);
|
if (needlock)
|
||||||
|
ast_mutex_unlock(&chan->lock);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1563,7 +1567,8 @@ int ast_set_read_format(struct ast_channel *chan, int fmts, int needlock)
|
|||||||
if (option_debug)
|
if (option_debug)
|
||||||
ast_log(LOG_DEBUG, "Set channel %s to read format %s\n",
|
ast_log(LOG_DEBUG, "Set channel %s to read format %s\n",
|
||||||
chan->name, ast_getformatname(chan->readformat));
|
chan->name, ast_getformatname(chan->readformat));
|
||||||
ast_mutex_unlock(&chan->lock);
|
if (needlock)
|
||||||
|
ast_mutex_unlock(&chan->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user