fail properly on bad decode

This commit is contained in:
Anthony Minessale 2012-01-23 14:53:38 -06:00
parent 7ac1d38d98
commit 7555cabbba
1 changed files with 4 additions and 6 deletions

View File

@ -863,13 +863,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
session->write_impl.actual_samples_per_second, session->write_impl.actual_samples_per_second,
session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &frame->flags); session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &frame->flags);
if (do_resample && status == SWITCH_STATUS_SUCCESS) { if (do_resample && status == SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_RESAMPLE; status = SWITCH_STATUS_RESAMPLE;
} }
switch (status) { switch (status) {
case SWITCH_STATUS_RESAMPLE: case SWITCH_STATUS_RESAMPLE:
resample++; resample++;
@ -918,11 +915,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
break; break;
default: default:
if (status == SWITCH_STATUS_NOT_INITALIZED) { if (status == SWITCH_STATUS_NOT_INITALIZED) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n");
goto error; goto error;
} }
if (ptime_mismatch) { if (ptime_mismatch && status != SWITCH_STATUS_GENERR) {
status = perform_write(session, frame, flags, stream_id); status = perform_write(session, frame, flags, stream_id);
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
goto error; goto error;
@ -933,7 +931,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
goto error; goto error;
} }
} }
if (session->write_resampler) { if (session->write_resampler) {