Minor tweak. Don't manipulate volume of the audio in the buffer if no audio is actually there.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@80157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2007-08-21 15:51:49 +00:00
parent eaac379751
commit 937d83f7e4

View File

@@ -189,7 +189,7 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho
/* Start with the read factory... if there are enough samples, read them in */
if (ast_slinfactory_available(&audiohook->read_factory) >= samples) {
if (ast_slinfactory_read(&audiohook->read_factory, buf1, samples))
if (ast_slinfactory_read(&audiohook->read_factory, buf1, samples)) {
read_buf = buf1;
/* Adjust read volume if need be */
if (audiohook->options.read_volume) {
@@ -202,12 +202,13 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho
ast_slinear_saturated_divide(&buf1[count], &adjust_value);
}
}
}
} else if (option_debug)
ast_log(LOG_DEBUG, "Failed to get %zd samples from read factory %p\n", samples, &audiohook->read_factory);
/* Move on to the write factory... if there are enough samples, read them in */
if (ast_slinfactory_available(&audiohook->write_factory) >= samples) {
if (ast_slinfactory_read(&audiohook->write_factory, buf2, samples))
if (ast_slinfactory_read(&audiohook->write_factory, buf2, samples)) {
write_buf = buf2;
/* Adjust write volume if need be */
if (audiohook->options.write_volume) {
@@ -220,6 +221,7 @@ static struct ast_frame *audiohook_read_frame_both(struct ast_audiohook *audioho
ast_slinear_saturated_divide(&buf2[count], &adjust_value);
}
}
}
} else if (option_debug)
ast_log(LOG_DEBUG, "Failed to get %zd samples from write factory %p\n", samples, &audiohook->write_factory);