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

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


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


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/74/8174/1

diff --git a/channels/chan_console.c b/channels/chan_console.c
index bc5f7f2..f09694b 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -280,7 +280,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) {
@@ -613,7 +615,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/8174
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: I635eacee45f5413faa18f5a3b606af03b926dacb
Gerrit-Change-Number: 8174
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/91264eed/attachment-0001.html>


More information about the asterisk-code-review mailing list