From 667507bda98c76090d9be802735a275f8fc2c039 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Sun, 20 Mar 2011 01:33:08 -0400 Subject: [PATCH] mod_portaudio: release the endpoint on hangup --- src/mod/endpoints/mod_portaudio/mod_portaudio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 07b7018004..98833d9d86 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -746,13 +746,19 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) if (tech_pvt->audio_endpoint) { audio_endpoint_t *endpoint = tech_pvt->audio_endpoint; + + tech_pvt->audio_endpoint = NULL; + switch_mutex_lock(endpoint->mutex); + release_stream_channel(endpoint->in_stream, endpoint->inchan, 1); release_stream_channel(endpoint->out_stream, endpoint->outchan, 0); switch_core_timer_destroy(&endpoint->read_timer); switch_core_timer_destroy(&endpoint->write_timer); switch_core_codec_destroy(&endpoint->read_codec); switch_core_codec_destroy(&endpoint->write_codec); + endpoint->master = NULL; + switch_mutex_unlock(endpoint->mutex); }