summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2018-02-09 09:31:16 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2018-02-09 09:31:16 -0600
commite132f22a2ef89ca7b7fa7e9a77d4e1aad64bf203 (patch)
treeed31ec294e3355f4390698a85c3608b45ae24531
parent7484ed25ff10dc19b00b87aa67a13ad7411ff2bb (diff)
parent5b8fea93d106332bc0faa4b7fa8a6ea71e546cac (diff)
Merge "chan_console: don't read and write at the same time"
-rw-r--r--channels/chan_console.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/channels/chan_console.c b/channels/chan_console.c
index 7c57ec4ff..7692b26cc 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -278,7 +278,9 @@ static void *stream_monitor(void *data)
for (;;) {
pthread_testcancel();
+ console_pvt_lock(pvt);
res = Pa_ReadStream(pvt->stream, buf, sizeof(buf) / sizeof(int16_t));
+ console_pvt_unlock(pvt);
pthread_testcancel();
if (!pvt->owner) {
@@ -611,7 +613,9 @@ static int console_write(struct ast_channel *chan, struct ast_frame *f)
{
struct console_pvt *pvt = ast_channel_tech_pvt(chan);
+ console_pvt_lock(pvt);
Pa_WriteStream(pvt->stream, f->data.ptr, f->samples);
+ console_pvt_unlock(pvt);
return 0;
}