[Asterisk-code-review] chan console: don't read and write at the same time (asterisk[15])

Joshua Colp asteriskteam at digium.com
Thu Feb 8 06:55:19 CST 2018


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/8173


Change subject: chan_console: don't read and write at the same time
......................................................................

chan_console: don't read and write at the same time

It seems that the ALSA backend of PortAudio doesn't know how to both
read and write at the same time by adding a per-device mutex.

FIXME: currently only a draft version. Need to either auto-detect
we work with the ALSA backend or add an extra configuration option
to use this mutex.

ASTERISK-27426 #close

Change-Id: I635eacee45f5413faa18f5a3b606af03b926dacb
---
M channels/chan_console.c
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/73/8173/1

diff --git a/channels/chan_console.c b/channels/chan_console.c
index 7c57ec4..7692b26 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -278,7 +278,9 @@
 
 	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 @@
 {
 	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;
 }

-- 
To view, visit https://gerrit.asterisk.org/8173
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I635eacee45f5413faa18f5a3b606af03b926dacb
Gerrit-Change-Number: 8173
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180208/07eb33c2/attachment.html>


More information about the asterisk-code-review mailing list