FS-11671 fix potential devided by zero error
This commit is contained in:
parent
ab129ffece
commit
463eb7294e
|
@ -957,9 +957,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
|||
|
||||
}
|
||||
|
||||
if (read_impl.actual_samples_per_second) {
|
||||
if (read_impl.actual_samples_per_second && fh->native_rate >= 1000) {
|
||||
switch_channel_set_variable_printf(channel, "record_seconds", "%d", fh->samples_out / fh->native_rate);
|
||||
switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_out / (fh->native_rate/ 1000));
|
||||
switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_out / (fh->native_rate / 1000));
|
||||
|
||||
}
|
||||
|
||||
|
@ -1941,10 +1941,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file %s\n", file);
|
||||
switch_channel_set_variable_printf(channel, "playback_last_offset_pos", "%d", fh->offset_pos);
|
||||
|
||||
if (read_impl.samples_per_second) {
|
||||
if (read_impl.samples_per_second && fh->native_rate >= 1000) {
|
||||
switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / fh->native_rate);
|
||||
switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / (fh->native_rate / 1000));
|
||||
}
|
||||
|
||||
switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_in);
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_PLAYBACK_STOP) == SWITCH_STATUS_SUCCESS) {
|
||||
|
|
Loading…
Reference in New Issue