summaryrefslogtreecommitdiff
path: root/res/res_musiconhold.c
diff options
context:
space:
mode:
authorWalter Doekes <walter+asterisk@wjd.nu>2014-01-17 14:17:04 +0000
committerWalter Doekes <walter+asterisk@wjd.nu>2014-01-17 14:17:04 +0000
commit72cb7a254fa1b856ddc0808b015eb80b65515fbd (patch)
treeed2feacb844e2c7e857a0ecb741ded31d8f1309d /res/res_musiconhold.c
parent1f6c34a6c9c1ca5c4e57de1a982560632edc2fa9 (diff)
Enable wide band audio in musiconhold streams.
Review: https://reviewboard.asterisk.org/r/3112/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405766 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r--res/res_musiconhold.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 086139ab8..58c908d9d 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -704,7 +704,8 @@ static void *monmp3thread(void *data)
ast_log(LOG_ERROR, "Failed to acknowledge timer for mp3player\n");
return NULL;
}
- res = 320;
+ /* 25 samples per second => 40ms framerate => 320 samples */
+ res = 320; /* 320/40 = 8 samples/ms */
} else {
ast_log(LOG_WARNING, "poll() failed: %s\n", strerror(errno));
res = 0;
@@ -725,8 +726,12 @@ static void *monmp3thread(void *data)
ast_log(LOG_NOTICE, "Request to schedule in the past?!?!\n");
deadline = tv_tmp;
}
- res = 8 * MOH_MS_INTERVAL; /* 8 samples per millisecond */
+ /* 10 samples per second (MOH_MS_INTERVAL) => 100ms framerate => 800 samples */
+ res = 8 * MOH_MS_INTERVAL; /* 800/100 = 8 samples/ms */
}
+ /* For non-8000Hz formats, we need to alter the resolution */
+ res = res * ast_format_rate(&class->format) / 8000;
+
if ((strncasecmp(class->dir, "http://", 7) && strcasecmp(class->dir, "nodir")) && AST_LIST_EMPTY(&class->members))
continue;
/* Read mp3 audio */