Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-03-08 00:52:24 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-03-08 00:52:24 (GMT)
commitcb29c2846e1b4157f2cac9ef5db6f67f1898d0bf (patch)
tree6ce2642252ae29f1932b9a943ca8dafc9214b587
parentacdb17adf14742f32d05dc8d797715d238a7df2a (diff)
Do not process empty chunks in espeak_out()
-rw-r--r--configure.ac2
-rw-r--r--src/espeak.c24
2 files changed, 8 insertions, 18 deletions
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 <unistd.h>
-
-
-#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
@@ -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);
}