From 7555cabbba39ac995a74637d5043dc2009f54159 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 23 Jan 2012 14:53:38 -0600 Subject: [PATCH] fail properly on bad decode --- src/switch_core_io.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index c55b891864..01e958b243 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -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->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &frame->flags); - - - if (do_resample && status == SWITCH_STATUS_SUCCESS) { status = SWITCH_STATUS_RESAMPLE; } - + switch (status) { case SWITCH_STATUS_RESAMPLE: resample++; @@ -918,11 +915,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess status = SWITCH_STATUS_SUCCESS; break; default: + if (status == SWITCH_STATUS_NOT_INITALIZED) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n"); goto error; } - if (ptime_mismatch) { + if (ptime_mismatch && status != SWITCH_STATUS_GENERR) { status = perform_write(session, frame, flags, stream_id); status = SWITCH_STATUS_SUCCESS; goto error; @@ -933,7 +931,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess goto error; } } - + if (session->write_resampler) {