From cb29c2846e1b4157f2cac9ef5db6f67f1898d0bf Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Sun, 08 Mar 2009 00:52:24 +0000 Subject: Do not process empty chunks in espeak_out() --- diff --git a/configure.ac b/configure.ac index b010c01..a561ddc 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([gst-plugin-espeak], [0.1]) +AC_INIT([gst-plugins-espeak], [0.1]) dnl versions of gstreamer and plugins-base GST_MAJORMINOR=0.10 diff --git a/src/espeak.c b/src/espeak.c index 563ee55..63c11e6 100644 --- a/src/espeak.c +++ b/src/espeak.c @@ -15,10 +15,6 @@ * Boston, MA 02111-1307, USA. */ -#include - - -#include #include #include #include @@ -332,19 +328,16 @@ espeak_out(Econtext *self, gsize size_to_play) for (;;) { g_mutex_lock(process_lock); - if ((g_atomic_int_get(&self->out->state) & (PLAY|OUT)) == 0) + while ((g_atomic_int_get(&self->out->state) & (PLAY|OUT)) == 0) { - if (g_atomic_int_get(&self->state) & INPROCESS) - { - GST_DEBUG("[%p]", self); - g_cond_wait(process_cond, process_lock); - } - else + if ((self->state & INPROCESS) == 0) { GST_DEBUG("[%p]", self); g_mutex_unlock(process_lock); return NULL; } + GST_DEBUG("[%p]", self); + g_cond_wait(process_cond, process_lock); } g_mutex_unlock(process_lock); @@ -522,8 +515,7 @@ process(gpointer data) else { GST_DEBUG("[%p]", context); - g_atomic_int_set(&context->state, - g_atomic_int_get(&context->state) & ~INPROCESS); + context->state &= ~INPROCESS; } } @@ -541,11 +533,9 @@ process_push(Econtext *context) GST_DEBUG("[%p]", context); g_mutex_lock(process_lock); - int self_status = g_atomic_int_get(&context->state); - - if ((self_status & INPROCESS) == 0) + if ((context->state & INPROCESS) == 0) { - g_atomic_int_set(&context->state, self_status | INPROCESS); + context->state |= INPROCESS; process_queue = g_slist_concat(process_queue, context->process_chunk); g_cond_broadcast(process_cond); } -- cgit v0.9.1