mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 11:42:27 +00:00
ensure buffer policy is restored after RAS is done with a channel (bug #4589, slightly simpler fix)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -130,9 +130,15 @@ static void run_ras(struct ast_channel *chan, char *args)
|
|||||||
int status;
|
int status;
|
||||||
int res;
|
int res;
|
||||||
int signalled = 0;
|
int signalled = 0;
|
||||||
struct zt_bufferinfo bi;
|
struct zt_bufferinfo savebi;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
|
res = ioctl(chan->fds[0], ZT_GET_BUFINFO, &savebi);
|
||||||
|
if(res) {
|
||||||
|
ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", chan->name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pid = spawn_ras(chan, args);
|
pid = spawn_ras(chan, args);
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
ast_log(LOG_WARNING, "Failed to spawn RAS\n");
|
ast_log(LOG_WARNING, "Failed to spawn RAS\n");
|
||||||
@@ -167,20 +173,11 @@ static void run_ras(struct ast_channel *chan, char *args)
|
|||||||
x = 1;
|
x = 1;
|
||||||
ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
|
ioctl(chan->fds[0], ZT_AUDIOMODE, &x);
|
||||||
|
|
||||||
/* Double check buffering too */
|
/* Restore saved values */
|
||||||
res = ioctl(chan->fds[0], ZT_GET_BUFINFO, &bi);
|
res = ioctl(chan->fds[0], ZT_SET_BUFINFO, &savebi);
|
||||||
if (!res) {
|
|
||||||
/* XXX This is ZAP_BLOCKSIZE XXX */
|
|
||||||
bi.bufsize = 204;
|
|
||||||
bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
|
|
||||||
bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
|
|
||||||
bi.numbufs = 4;
|
|
||||||
res = ioctl(chan->fds[0], ZT_SET_BUFINFO, &bi);
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", chan->name);
|
ast_log(LOG_WARNING, "Unable to set buffer policy on channel %s\n", chan->name);
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
ast_log(LOG_WARNING, "Unable to check buffer policy on channel %s\n", chan->name);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user