[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
WIP audio in server
From: |
Luke Yelavich |
Subject: |
WIP audio in server |
Date: |
Wed, 13 Apr 2016 16:40:41 +1000 |
On Fri, Feb 26, 2016 at 09:34:51AM AEDT, Jeremy Whiting wrote:
> If anyone has other feedback on the patch itself I would appreciate it.
Ok, some comments, this is a bit of a brain dump, as its almost EOD here...
I see you create a thread in src/server/audio.c in speechd_audio_init, which
sets everything up, and then essentially waits for audio_close_requested to be
set to TRUE, which is not done anywhere in code. Can I assume this is a
WIP/TODO part of this work?
In the audio thread method, you also add the fd to the GLib main loop to listen
for activity from modules, and then subsequently add more descriptors for
modules. I guess you are trying to have all audio related stuff be done in that
audio thread? If so, I don't think its correct, given my understanding of GLib
main loops. GLib main loops poll and respond to fd activity in the thread they
are in, so at the moment you have a thread sitting there doing nothing, since
nothing changes the state of the semaphore or audio_close_requested. Meanwhile
all audio activity is in the main thread running of the main thread's main loop.
If you want to use the same sort of mechanism for audio in another thread, you
have to create a new main context, and create a new main loop with that
context, and add all descriptors to poll based on that main loop and context.
YOu would then use g_main_loop_quit in the same thread to close down and clean
up.
I can have a crack at updating the code to use a separate main loop as per
above if you like, although I am not sure what you are planning to do with that
semaphore, as in where you think it will be used.
Luke