]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_portaudio: few more checks on write
authorMoises Silva <moy@sangoma.com>
Fri, 20 May 2011 06:28:42 +0000 (02:28 -0400)
committerMoises Silva <moy@sangoma.com>
Fri, 20 May 2011 06:28:42 +0000 (02:28 -0400)
src/mod/endpoints/mod_portaudio/mod_portaudio.c

index 44df30ad71f8d4274587c461d8ce42327c808cd1..743a6568fbd3f3cce75e00a23dcf8fb154d7e721 100644 (file)
@@ -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));