speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

speak() in python ignoring callback (for BEGIN)


From: Richard Schwarting
Subject: speak() in python ignoring callback (for BEGIN)
Date: Mon, 6 Apr 2009 21:49:47 +1200

Hello.

For the Python support, in src/python/speechd/client.py, in speak(),
there's this nice little section:

===========================================
        result = self._conn.send_data(text)
        if callback:
            msg_id = int(result[2][0])
            # TODO: Here we risk, that the callback arrives earlier, than we
            # add the item to `self._callbacks'.  Such a situation will lead to
            # the callback being ignored.
            self._lock.acquire()
            try:
                self._callbacks[msg_id] = (callback, event_types)
            finally:
                self._lock.release()
        return result
===========================================

The issue described there is very real.  I have an application that
relies on knowing when the speech stream is supposed to have actually
begun (it's not appropriate to just assume it has just because I
called speak()), so on slightly faster systems or after the first few
runs (because more is in memory or optimised?), the callback gets
missed virtually all the time :|

I filed a bug with my distro (Fedora):
https://bugzilla.redhat.com/show_bug.cgi?id=494298

If someone has an idea what the proper solution would be (wait around
in a thread for the value to show up? - right now I've simply added a
second-long sleep locally (ugh)), I don't mind going about
implementing + testing it next weekend.

Cheers,
  Richard Schwarting



reply via email to

[Prev in Thread] Current Thread [Next in Thread]