summaryrefslogtreecommitdiff
path: root/apps/app_nbscat.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-04-26 03:02:49 +0000
committerMark Spencer <markster@digium.com>2004-04-26 03:02:49 +0000
commitce44c6ec411ad7c1435b4d882d4479f9ad1a2149 (patch)
treef42052117101b06005792ef797580ab7ba46a2c6 /apps/app_nbscat.c
parent459fda5e44df80397dfa344cffdbbf5cd5c0102c (diff)
More select/poll updates for various applications
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2762 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_nbscat.c')
-rwxr-xr-xapps/app_nbscat.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/apps/app_nbscat.c b/apps/app_nbscat.c
index ed5116d7e..d1b836852 100755
--- a/apps/app_nbscat.c
+++ b/apps/app_nbscat.c
@@ -1,7 +1,7 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
- * Silly application to play an NBScat file -- uses mpg123
+ * Silly application to play an NBScat file -- uses nbscat8k
*
* Copyright (C) 1999, Mark Spencer
*
@@ -71,11 +71,10 @@ static int NBScatplay(int fd)
static int timed_read(int fd, void *data, int datalen)
{
int res;
- fd_set fds;
- struct timeval tv = { 2, 0 }; /* Wait no more than 2 seconds */
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
- res = ast_select(fd + 1, &fds, NULL, NULL, &tv);
+ struct pollfd fds[1];
+ fds[0].fd = fd;
+ fds[0].events = POLLIN;
+ res = poll(fds, 1, 2000);
if (res < 1) {
ast_log(LOG_NOTICE, "Selected timed out/errored out with %d\n", res);
return -1;
@@ -129,7 +128,7 @@ static int NBScat_exec(struct ast_channel *chan, void *data)
res = -1;
break;
}
- if (ms) {
+ if (ms > 40) {
f = ast_read(chan);
if (!f) {
ast_log(LOG_DEBUG, "Null frame == hangup() detected\n");
@@ -165,7 +164,7 @@ static int NBScat_exec(struct ast_channel *chan, void *data)
res = 0;
break;
}
- ms = res / 16;
+ ms += res / 16;
}
}
}