}
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) {
close(fds[0]);
close(fds[1]);
if (pid > -1)
kill(pid, SIGKILL);
if (!res && oreadformat)
- ast_set_read_format(chan, oreadformat);
+ ast_set_read_format(chan, oreadformat, 0);
return res;
}
ast_stopstream(chan);
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) {
ast_log(LOG_WARNING, "Unable to set write format to signed linear\n");
return -1;
if (pid > -1)
kill(pid, SIGKILL);
if (!res && owriteformat)
- ast_set_write_format(chan, owriteformat);
+ ast_set_write_format(chan, owriteformat, 0);
return res;
}
int native;
int res;
- ast_mutex_lock(&chan->lock);
+ if (needlock)
+ ast_mutex_lock(&chan->lock);
native = chan->nativeformats;
fmt = fmts;
if (res < 0) {
ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
ast_getformatname(fmts), ast_getformatname(chan->nativeformats));
- ast_mutex_unlock(&chan->lock);
+ if (needlock)
+ ast_mutex_unlock(&chan->lock);
return -1;
}
chan->pvt->writetrans = ast_translator_build_path(chan->pvt->rawwriteformat, chan->writeformat);
if (option_debug)
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;
}
if (res < 0) {
ast_log(LOG_NOTICE, "Unable to find a path from %s to %s\n",
ast_getformatname(chan->nativeformats), ast_getformatname(fmts));
- ast_mutex_unlock(&chan->lock);
+ if (needlock)
+ ast_mutex_unlock(&chan->lock);
return -1;
}
if (option_debug)
ast_log(LOG_DEBUG, "Set channel %s to read format %s\n",
chan->name, ast_getformatname(chan->readformat));
- ast_mutex_unlock(&chan->lock);
+ if (needlock)
+ ast_mutex_unlock(&chan->lock);
return 0;
}