From ce4b02e0038d2e5c53122ce09dd3f9ef148ec281 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Mon, 26 Jul 2021 23:55:29 -0700 Subject: [PATCH] soundd checks (#21717) old-commit-hash: a5cb17b460612e8d1afeb2736d6d9a0bb72050a6 --- selfdrive/ui/soundd.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/selfdrive/ui/soundd.cc b/selfdrive/ui/soundd.cc index 318449930d..02065499ba 100644 --- a/selfdrive/ui/soundd.cc +++ b/selfdrive/ui/soundd.cc @@ -32,6 +32,7 @@ public: for (auto &[alert, fn, loops] : sound_list) { sounds[alert].first.setSource(QUrl::fromLocalFile(fn)); sounds[alert].second = loops ? QSoundEffect::Infinite : 0; + QObject::connect(&sounds[alert].first, &QSoundEffect::statusChanged, this, &Sound::checkStatus); } sm = new SubMaster({"carState", "controlsState"}); @@ -45,6 +46,12 @@ public: }; private slots: + void checkStatus() { + for (auto &[alert, kv] : sounds) { + assert(kv.first.status() != QSoundEffect::Error); + } + } + void update() { sm->update(100); if (sm->updated("carState")) {