What do you think happens when two threads read from visdn channels,
at the same time?
Answer: You may get random bursts of sound from the other channel.
diff --git a/chan_visdn/chan_visdn.c b/chan_visdn/chan_visdn.c
index 9aa2e5c..349439a 100644
--- a/chan_visdn/chan_visdn.c
+++ b/chan_visdn/chan_visdn.c
@@ -1904,29 +1904,29 @@ static int visdn_hangup(struct ast_chann
return 0;
}
+static struct ast_frame f_null = {
+ .src = VISDN_CHAN_TYPE,
+ .mallocd = 0,
+ .delivery.tv_sec = 0,
+ .delivery.tv_usec = 0,
+ .frametype = AST_FRAME_NULL,
+ .subclass = 0,
+ .samples = 0,
+ .datalen = 0,
+ .data = NULL,
+ .offset = 0,
+};
+
static struct ast_frame *visdn_read(struct ast_channel *ast_chan)
{
struct visdn_chan *visdn_chan = to_visdn_chan(ast_chan);
- static struct ast_frame f;
+ struct ast_frame f;
/* Acknowledge timer */
read(ast_chan->fds[0], visdn_chan->buf, 1);
- f.src = VISDN_CHAN_TYPE;
- f.mallocd = 0;
- f.delivery.tv_sec = 0;
- f.delivery.tv_usec = 0;
-
- if (visdn_chan->sp_fd < 0) {
- f.frametype = AST_FRAME_NULL;
- f.subclass = 0;
- f.samples = 0;
- f.datalen = 0;
- f.data = NULL;
- f.offset = 0;
-
- return &f;
- }
+ if (visdn_chan->sp_fd < 0)
+ return &f_null;
int nread = read(visdn_chan->sp_fd, visdn_chan->buf,
sizeof(visdn_chan->buf));
@@ -1953,6 +1953,12 @@ ast_verbose(VERBOSE_PREFIX_3 "R %.3f %02
nread);
#endif
+ f.frametype = AST_FRAME_NULL;
+ f.subclass = 0;
+ f.samples = 0;
+ f.datalen = 0;
+ f.data = NULL;
+ f.offset = 0;
f.frametype = AST_FRAME_VOICE;
f.subclass = AST_FORMAT_ALAW;
f.samples = nread;
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [EMAIL PROTECTED]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
The moment the little boy is concerned with which is a jay and which
is a sparrow, he can no longer see the birds or hear them sing.
-- Eric Berne
_______________________________________________
Visdn-hackers mailing list
[email protected]
https://mailman.uli.it/mailman/listinfo/visdn-hackers