From 267d9cbc3adcb291eadfc4647ef3797876e4a2e1 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Fri, 20 May 2011 02:28:42 -0400 Subject: [PATCH] mod_portaudio: few more checks on write --- src/mod/endpoints/mod_portaudio/mod_portaudio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 44df30ad71..743a6568fb 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -969,6 +969,15 @@ static switch_status_t channel_endpoint_write(audio_endpoint_t *endpoint, switch switch_core_timer_next(&endpoint->write_timer); return SWITCH_STATUS_SUCCESS; } + if (!endpoint->master) { + return SWITCH_STATUS_SUCCESS; + } + if (switch_test_flag(endpoint->master, TFLAG_HUP)) { + return SWITCH_STATUS_FALSE; + } + if (!switch_test_flag(endpoint->master, TFLAG_IO)) { + return SWITCH_STATUS_SUCCESS; + } WriteAudioStream(endpoint->out_stream->stream, (short *)frame->data, (int)(frame->datalen / sizeof(SAMPLE)), endpoint->outchan, &(endpoint->write_timer));