make sure realtime/high scheduling priority is relinquished before executing an AGI...
authorKevin P. Fleming <kpfleming@digium.com>
Tue, 23 Aug 2005 01:30:22 +0000 (01:30 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Tue, 23 Aug 2005 01:30:22 +0000 (01:30 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6368 65c4cc65-6c06-0410-ace0-fbb531ad65f3

asterisk.c
include/asterisk.h
res/res_agi.c

index dedf23e..fe28615 100755 (executable)
@@ -674,7 +674,7 @@ static void set_icon(char *text)
                fprintf(stdout, "\033]1;%s\007", text);
 }
 
-static int set_priority(int pri)
+int ast_set_priority(int pri)
 {
        struct sched_param sched;
        memset(&sched, 0, sizeof(sched));
@@ -1940,7 +1940,7 @@ int main(int argc, char *argv[])
                ast_verbose("[ Reading Master Configuration ]");
        ast_readconfig();
 
-       if (set_priority(option_highpriority)) {
+       if (ast_set_priority(option_highpriority)) {
                exit(1);
        }
 
index 708d503..e10200b 100755 (executable)
@@ -37,6 +37,8 @@ extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH];
 extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH];
 
+/* Provided by asterisk.c */
+extern int ast_set_priority(int);
 /* Provided by module.c */
 extern int load_modules(const int preload_only);
 /* Provided by pbx.c */
index 9dd62fb..89b25e7 100755 (executable)
@@ -279,6 +279,9 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op
                for (x=STDERR_FILENO + 2;x<1024;x++) 
                        close(x);
 
+               /* Don't run AGI scripts with realtime priority -- it causes audio stutter */
+               ast_set_priority(0);
+
                /* Execute script */
                execv(script, argv);
                /* Can't use ast_log since FD's are closed */