[modules/pulseaudio] rate-limit pulseaudio events
attempting a different tack: Reduce the amount of draws that are being emitted by the pulseaudio module to max. 2/s. That hopefully increases reactivity and at the same time keeps flickering to a minimum. see #917
This commit is contained in:
parent
40041d6080
commit
ee81f6198e
1 changed files with 5 additions and 0 deletions
|
@ -34,6 +34,7 @@ Requires the following executable:
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
import logging
|
import logging
|
||||||
import functools
|
import functools
|
||||||
import threading
|
import threading
|
||||||
|
@ -126,12 +127,16 @@ class Module(core.module.Module):
|
||||||
r, w, e = select.select([proc.stdout], [], [], 1)
|
r, w, e = select.select([proc.stdout], [], [], 1)
|
||||||
|
|
||||||
if not (r or w or e):
|
if not (r or w or e):
|
||||||
|
self.update2()
|
||||||
|
core.event.trigger("update", [self.id], redraw_only=True)
|
||||||
|
core.event.trigger("draw")
|
||||||
continue # timeout
|
continue # timeout
|
||||||
# whateve we got, use it
|
# whateve we got, use it
|
||||||
self.update2()
|
self.update2()
|
||||||
core.event.trigger("update", [self.id], redraw_only=True)
|
core.event.trigger("update", [self.id], redraw_only=True)
|
||||||
core.event.trigger("draw")
|
core.event.trigger("draw")
|
||||||
os.set_blocking(proc.stdout.fileno(), False)
|
os.set_blocking(proc.stdout.fileno(), False)
|
||||||
|
time.sleep(0.5)
|
||||||
proc.stdout.read()
|
proc.stdout.read()
|
||||||
os.set_blocking(proc.stdout.fileno(), True)
|
os.set_blocking(proc.stdout.fileno(), True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue