提交 6569a44d authored 作者: Brian West's avatar Brian West 提交者: Mike Jerris

FS-11496: [core] fix crash with four channel sound file

上级 118dd796
...@@ -404,6 +404,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, ...@@ -404,6 +404,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file,
if (fh->real_channels != fh->channels && (flags & SWITCH_FILE_FLAG_READ) && !(fh->flags & SWITCH_FILE_NOMUX)) { if (fh->real_channels != fh->channels && (flags & SWITCH_FILE_FLAG_READ) && !(fh->flags & SWITCH_FILE_NOMUX)) {
fh->cur_channels = fh->real_channels;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File has %d channels, muxing to %d channel%s will occur.\n", fh->real_channels, fh->channels, fh->channels == 1 ? "" : "s"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File has %d channels, muxing to %d channel%s will occur.\n", fh->real_channels, fh->channels, fh->channels == 1 ? "" : "s");
} }
......
...@@ -1664,7 +1664,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1664,7 +1664,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
} }
} }
buflen = (FILE_STARTSAMPLES * sizeof(*abuf) * fh->cur_channels) > 0 ? fh->cur_channels : fh->channels; buflen = FILE_STARTSAMPLES * sizeof(*abuf) * (fh->cur_channels > 0 ? fh->cur_channels : fh->channels);
if (buflen > write_frame.buflen) { if (buflen > write_frame.buflen) {
abuf = realloc(abuf, buflen); abuf = realloc(abuf, buflen);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论