mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +00:00
- add get_max_rate timing API call
- change ast_settimeout() to honor max rate in edge cases of file playback (this will make some warning messages go away at the end of playing back a file) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@125332 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2174,6 +2174,7 @@ int ast_waitfordigit(struct ast_channel *c, int ms)
|
||||
int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const void *data), void *data)
|
||||
{
|
||||
int res;
|
||||
unsigned int real_rate = rate, max_rate;
|
||||
|
||||
if (c->timingfd == -1) {
|
||||
return -1;
|
||||
@@ -2184,9 +2185,13 @@ int ast_settimeout(struct ast_channel *c, unsigned int rate, int (*func)(const v
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
ast_debug(1, "Scheduling timer at %u timer ticks per second\n", rate);
|
||||
if (rate && rate > (max_rate = ast_timer_get_max_rate(c->timingfd))) {
|
||||
real_rate = max_rate;
|
||||
}
|
||||
|
||||
res = ast_timer_set_rate(c->timingfd, rate);
|
||||
ast_debug(1, "Scheduling timer at (%u requested / %u actual) timer ticks per second\n", rate, real_rate);
|
||||
|
||||
res = ast_timer_set_rate(c->timingfd, real_rate);
|
||||
|
||||
c->timingfunc = func;
|
||||
c->timingdata = data;
|
||||
|
||||
Reference in New Issue
Block a user