mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 08:13:22 +00:00
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:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user