提交 20d17baa authored 作者: Anthony Minessale's avatar Anthony Minessale

set idle pattern to 255 instead of 0 to prevent clipping sound on short frames…

set idle pattern to 255 instead of 0 to prevent clipping sound on short frames from mod_native_file FS-2772
上级 c0fddf05
...@@ -1292,7 +1292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1292,7 +1292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
if (framelen > FILE_STARTSAMPLES) { if (framelen > FILE_STARTSAMPLES) {
framelen = FILE_STARTSAMPLES; framelen = FILE_STARTSAMPLES;
} }
memset(abuf, 0, framelen); memset(abuf, 255, framelen);
olen = ilen; olen = ilen;
do_speed = 0; do_speed = 0;
} else if (fh->sp_audio_buffer && (eof || (switch_buffer_inuse(fh->sp_audio_buffer) > (switch_size_t) (framelen)))) { } else if (fh->sp_audio_buffer && (eof || (switch_buffer_inuse(fh->sp_audio_buffer) > (switch_size_t) (framelen)))) {
...@@ -1305,7 +1305,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1305,7 +1305,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
} }
if (bread < framelen) { if (bread < framelen) {
memset(abuf + bread, 0, framelen - bread); memset(abuf + bread, 255, framelen - bread);
} }
olen = asis ? framelen : ilen; olen = asis ? framelen : ilen;
...@@ -1320,7 +1320,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1320,7 +1320,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
} }
if (bread < framelen) { if (bread < framelen) {
memset(abuf + bread, 0, framelen - bread); memset(abuf + bread, 255, framelen - bread);
} }
olen = asis ? framelen : ilen; olen = asis ? framelen : ilen;
...@@ -1408,10 +1408,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1408,10 +1408,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
last_speed = fh->speed; last_speed = fh->speed;
continue; continue;
} }
if (olen < llen) { if (olen < llen) {
uint8_t *dp = (uint8_t *) write_frame.data; uint8_t *dp = (uint8_t *) write_frame.data;
memset(dp + (int) olen, 0, (int) (llen - olen)); memset(dp + (int) olen, 255, (int) (llen - olen));
olen = llen; olen = llen;
} }
...@@ -1476,7 +1476,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1476,7 +1476,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
} }
#endif #endif
#endif #endif
if (fh->vol) { if (!asis && fh->vol) {
switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol); switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论