From e7cafae29d0720f06280255a55cc94548e7e12a4 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 5 Oct 2010 09:59:13 -0500 Subject: [PATCH] tweak --- src/include/switch_types.h | 2 ++ src/switch_channel.c | 8 ++++++++ src/switch_core_io.c | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 32fb141d42..5aecca7498 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -123,6 +123,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application" #define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE "current_application_data" #define SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE "current_application_response" +#define SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE "passthru_ptime_mismatch" #define SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE "enable_heartbeat_events" #define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE "bypass_media_after_bridge" #define SWITCH_READ_RESULT_VARIABLE "read_result" @@ -1055,6 +1056,7 @@ typedef enum { CF_EARLY_HANGUP, CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, + CF_PASSTHRU_PTIME_MISMATCH, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/switch_channel.c b/src/switch_channel.c index 81baa2f40d..df5fd9627e 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2559,6 +2559,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_core_session_execute_application(channel->session, app, arg); } + if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { + switch_channel_set_flag(channel, CF_PASSTHRU_PTIME_MISMATCH); + } + /* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel */ @@ -2686,6 +2690,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_core_session_rwunlock(other_session); } + if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { + switch_channel_set_flag(channel, CF_PASSTHRU_PTIME_MISMATCH); + } + if ((var = switch_channel_get_variable(channel, SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE))) { uint32_t seconds = 60; int tmp; diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 1eb224bda1..4ca8b2d8cb 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -653,7 +653,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (session->write_impl.codec_id == frame->codec->implementation->codec_id || session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) { ptime_mismatch = TRUE; - if (switch_test_flag(frame->codec, SWITCH_CODEC_FLAG_PASSTHROUGH) || switch_test_flag(session->read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) { + if ((switch_test_flag(frame->codec, SWITCH_CODEC_FLAG_PASSTHROUGH) || switch_test_flag(session->read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) || + switch_channel_test_flag(session->channel, CF_PASSTHRU_PTIME_MISMATCH)) { status = perform_write(session, frame, flags, stream_id); goto error; }