From dbe4a4850a890105355a9cdf578bf02a01ecde86 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 20 Mar 2011 02:36:46 -0400 Subject: [PATCH] mod_portaudio: do not destroy codec and timers if there is a call in progress! --- .../endpoints/mod_portaudio/mod_portaudio.c | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index e27d24b190..291cc00c4a 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -1245,17 +1245,19 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi error: if (endpoint) { - if (endpoint->read_timer.interval) { - switch_core_timer_destroy(&endpoint->read_timer); - } - if (endpoint->write_timer.interval) { - switch_core_timer_destroy(&endpoint->write_timer); - } - if (endpoint->read_codec.codec_interface) { - switch_core_codec_destroy(&endpoint->read_codec); - } - if (endpoint->write_codec.codec_interface) { - switch_core_codec_destroy(&endpoint->write_codec); + if (!endpoint->master) { + if (endpoint->read_timer.interval) { + switch_core_timer_destroy(&endpoint->read_timer); + } + if (endpoint->write_timer.interval) { + switch_core_timer_destroy(&endpoint->write_timer); + } + if (endpoint->read_codec.codec_interface) { + switch_core_codec_destroy(&endpoint->read_codec); + } + if (endpoint->write_codec.codec_interface) { + switch_core_codec_destroy(&endpoint->write_codec); + } } switch_mutex_unlock(endpoint->mutex); }