mirror of https://github.com/commaai/openpilot.git
micd: revert check playing sound (high cpu usage) (#26672)
* don't use hardware * check micd proc * use pactl package * cleanup * Revert "cleanup" This reverts commitbaf9887e2d
. * Revert "use pactl package" This reverts commit0c1f3a4b86
. * Revert "micd: don't update filtered sound level if playing sound (#26652)" This reverts commit86cd919a57
. * Revert "check micd proc" This reverts commit9ebbe2aa42
. Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
This commit is contained in:
parent
c0d545523e
commit
060b69ee2f
|
@ -43,10 +43,6 @@ class HardwareBase(ABC):
|
|||
def get_sound_card_online(self):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def is_sound_playing(self):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_imei(self, slot) -> str:
|
||||
pass
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import random
|
||||
import subprocess
|
||||
|
||||
from cereal import log
|
||||
from system.hardware.base import HardwareBase, ThermalConfig
|
||||
|
@ -18,9 +17,6 @@ class Pc(HardwareBase):
|
|||
def get_sound_card_online(self):
|
||||
return True
|
||||
|
||||
def is_sound_playing(self):
|
||||
return "RUNNING" in subprocess.check_output(["pactl", "list", "short", "sinks"]).decode('utf8')
|
||||
|
||||
def reboot(self, reason=None):
|
||||
print("REBOOT!")
|
||||
|
||||
|
|
|
@ -96,9 +96,6 @@ class Tici(HardwareBase):
|
|||
return (os.path.isfile('/proc/asound/card0/state') and
|
||||
open('/proc/asound/card0/state').read().strip() == 'ONLINE')
|
||||
|
||||
def is_sound_playing(self):
|
||||
return "RUNNING" in subprocess.check_output(["pactl", "list", "short", "sinks"]).decode('utf8')
|
||||
|
||||
def reboot(self, reason=None):
|
||||
subprocess.check_output(["sudo", "reboot"])
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import numpy as np
|
|||
from cereal import messaging
|
||||
from common.filter_simple import FirstOrderFilter
|
||||
from common.realtime import Ratekeeper
|
||||
from system.hardware import HARDWARE
|
||||
from system.swaglog import cloudlog
|
||||
|
||||
RATE = 10
|
||||
|
@ -60,8 +59,7 @@ class Mic:
|
|||
sound_pressure, _ = calculate_spl(self.measurements)
|
||||
measurements_weighted = apply_a_weighting(self.measurements)
|
||||
sound_pressure_weighted, sound_pressure_level_weighted = calculate_spl(measurements_weighted)
|
||||
if not HARDWARE.is_sound_playing():
|
||||
self.spl_filter_weighted.update(sound_pressure_level_weighted)
|
||||
self.spl_filter_weighted.update(sound_pressure_level_weighted)
|
||||
else:
|
||||
sound_pressure = 0
|
||||
sound_pressure_weighted = 0
|
||||
|
|
Loading…
Reference in New Issue