Hi, I wrote:

> Sorry about that; expect a working patch shortly.

This one seems to be OK. The last hunk also fixes yet another unwarranted
assertion. (Maybe some locking is called for?)

diff -u b/chan_visdn/chan_visdn.c b/chan_visdn/chan_visdn.c
--- b/chan_visdn/chan_visdn.c
+++ b/chan_visdn/chan_visdn.c
@@ -1904,29 +1904,29 @@
        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));
@@ -1938,7 +1938,7 @@
                                        sizeof(visdn_chan->buf));
        if (nread < 0) {
                ast_log(LOG_WARNING, "read error: %s\n", strerror(errno));
-               return &f;
+               return &f_null;
        }

 #if 0
@@ -1965,8 +1965,18 @@
        f.datalen = nread;
        f.data = visdn_chan->buf;
        f.offset = 0;
+       f.mallocd = 0;

        struct ast_frame *f2 = ast_dsp_process(ast_chan, visdn_chan->dsp, &f);
+       if(&f == f2) {
+               f2 = malloc(sizeof(f));
+               if(!f2) {
+                       ast_log(LOG_ERROR, "Out of memory\n");
+                       return NULL;
+               }
+               *f2 = f;
+               f2->mallocd = AST_MALLOCD_HDR;
+       }

        return f2;
 }
@@ -4029,11 +4039,19 @@
 {
        FUNC_DEBUG();

-       assert(channel->call);
+       if(!channel->call)
+               {
+               ast_log(LOG_WARNING, "Unexpexted call NULL\n");
+               return;
+               }
+
        struct ast_channel *ast_chan = callpvt_to_astchan(channel->call);

        if (!ast_chan)
+               {
+               ast_log(LOG_WARNING, "Unexpexted ast_chan NULL\n");
                return;
+               }

        ast_mutex_lock(&ast_chan->lock);

@k
-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  [EMAIL PROTECTED]
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
If you are going to walk on thin ice, you may as well dance.

_______________________________________________
Visdn-hackers mailing list
[email protected]
https://mailman.uli.it/mailman/listinfo/visdn-hackers

Reply via email to