everything related to duct tape audio suite (dtas)
 help / color / Atom feed
* [PATCH] dtas-readahead: avoid polling on pause
@ 2015-09-23 20:15 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-09-23 20:15 UTC (permalink / raw)
  To: dtas-all

When a player is paused with nothing player, we will not waste CPU
time polling for the player to become available.  It is wasteful
of processing power and battery life.
---
 bin/dtas-readahead | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/bin/dtas-readahead b/bin/dtas-readahead
index f02bc35..798a5b4 100644
--- a/bin/dtas-readahead
+++ b/bin/dtas-readahead
@@ -190,12 +190,16 @@ begin
     end
     idx or break
     cur = YAML.load(c.req('current'))
-    cur['current'] or break
+    current = cur['current'] or break
+  end
+  if current
+    elapsed = DTAS.now - t0
+    p [:elapsed, elapsed]
+    timeout = 5 - elapsed
+    timeout = 0 if timeout < 0
+  else
+    timeout = nil
   end
-  elapsed = DTAS.now - t0
-  p [:elapsed, elapsed]
-  timeout = 5 - elapsed
-  timeout = 0 if timeout < 0
   r = wait_read(w, timeout)
   p w.res_wait if r
 rescue EOFError
-- 
EW



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-23 20:15 [PATCH] dtas-readahead: avoid polling on pause Eric Wong

everything related to duct tape audio suite (dtas)

Archives are clonable:
	git clone --mirror https://80x24.org/dtas-all
	git clone --mirror http://ou63pmih66umazou.onion/dtas-all

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.dtas
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.dtas

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git