diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@no-log.org> | 2012-06-05 20:11:18 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@no-log.org> | 2012-06-05 20:12:27 +0200 |
commit | 86c4b36f07a867706eff32713ee9d27fad38563d (patch) | |
tree | 69e0d214124251555d727ad10033e429727ae0a1 /fsoaudiod | |
parent | b84db848342a3885dc812499db529a44365267d3 (diff) | |
download | cornucopia-86c4b36f07a867706eff32713ee9d27fad38563d.tar.gz cornucopia-86c4b36f07a867706eff32713ee9d27fad38563d.tar.bz2 cornucopia-86c4b36f07a867706eff32713ee9d27fad38563d.zip |
fsoaudiod: alsaloop gsmvoice_alsa_forwarder plugin: fix high CPU usage before call.
Thanks a lot DocScrutinizer05 on #openmoko-cdevel FreeNode IRC Channel:
Jun 04 23:26:42 <gnutoo> there is a call incomming or outgoing
Jun 04 23:26:48 <gnutoo> fsogsmd knows it
Jun 04 23:26:57 <gnutoo> so it tells it on dbus
Jun 04 23:27:06 <gnutoo> fsoaudiod which is listenning on dbug get that message
Jun 04 23:27:15 <gnutoo> and activate the alsaloop based plugin
Jun 04 23:27:17 <gnutoo> however....
[...]
#Jun 04 23:27:17 * backb0ne__ (~backb0ne@27.Red-88-26-71.staticIP.rima-tde.net) has joined #openmoko-cdevel
Jun 04 23:27:28 <gnutoo> there is a time between that activation and when the modem is ready
Jun 04 23:27:39 <gnutoo> because the modem is the one who is clock master
Jun 04 23:27:53 <DocScrutinizer05> ouch
Jun 04 23:27:57 <gnutoo> so then what happens in alsaloop is that poll() returns too fast
Jun 04 23:28:18 <DocScrutinizer05> instantly with -EAGAIN I guess
Jun 04 23:28:48 <gnutoo> like the asoc poll() is broken for our case where the clocks master are from the modem
Jun 04 23:29:05 <DocScrutinizer05> in which case alsaloop SHOULD call a usleep(1000)
Jun 04 23:29:35 <gnutoo> that poll() returning too fast (30us) instead of 30000000us or something big like that causes the 100% CPU usage
Jun 04 23:29:51 <gnutoo> and then the 100% CPU usage causes other problem once the modem is started
Jun 04 23:29:55 <gnutoo> because it doesn't sotp
Jun 04 23:29:57 <gnutoo> *stop
[...]
Jun 04 23:30:00 <DocScrutinizer05> yep, that's why alsaloop needs a usleep()
[...]
Jun 04 23:33:21 <DocScrutinizer05> not if you put it at the right location
Jun 04 23:33:31 <DocScrutinizer05> immediately *before* the poll()
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
Diffstat (limited to 'fsoaudiod')
-rw-r--r-- | fsoaudiod/src/plugins/gsmvoice_alsa_forwarder/alsaloop.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fsoaudiod/src/plugins/gsmvoice_alsa_forwarder/alsaloop.c b/fsoaudiod/src/plugins/gsmvoice_alsa_forwarder/alsaloop.c index 2b4c9e7b..3d4068be 100644 --- a/fsoaudiod/src/plugins/gsmvoice_alsa_forwarder/alsaloop.c +++ b/fsoaudiod/src/plugins/gsmvoice_alsa_forwarder/alsaloop.c @@ -741,6 +741,7 @@ static void thread_job1(void *_data) } if (verbose > 10) gettimeofday(&tv1, NULL); + usleep(1000); err = poll(pfds, j, wake); if (err < 0) err = -errno; |