Hi all,

I think I found the problem why the transcodec does not work all the time.

The problem is the new generator thread:

  when opbx_generator_deactivate() is called, the ongoing code expects
  the generator to be really deactivated and everything cleaned up.
  But since the real deactivation is done in the thread itself, its 
  execution will be delayed.

  This means for example in corelib/indications.c the function
   static void playtones_release(struct opbx_channel *chan, void *params)
   {
        struct playtones_state *ps = params;
        if (chan) {
                opbx_set_write_format(chan, ps->origwfmt);
        }
        if (ps->items) free(ps->items);
        free(ps);
   } 
  will be executed after opbx_channel_make_compatible() and the
  writeformat is re-changed to a wrong setting.

The following patch fixes that, but it is not a nice solution. Maybe the 
originator of the channel.c/generator.c split-off can have a look at this.

Until there is a better idea, I will commit this patch to make OpenPBX 
work again.

Armin


--- OpenPBX.orig/corelib/generator.c    2005-11-18 04:31:40.000000000 +0100
+++ OpenPBX/corelib/generator.c 2005-12-23 16:32:31.611838655 +0100
@@ -164,6 +131,8 @@
        pgcd->gen_req = gen_req_deactivate;
        opbx_cond_signal(&pgcd->gen_req_cond);
        opbx_mutex_unlock(&pgcd->lock);
+       while (opbx_generator_is_active(chan))
+               usleep(1000);
 }
 
 /* Is channel generator active? */

_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev

Reply via email to