mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-20 13:32:04 +08:00
make soundd exit cleanly (#22794)
This commit is contained in:
@@ -49,7 +49,7 @@ class TestManager(unittest.TestCase):
|
||||
self.assertTrue(state.running, f"{p} not running")
|
||||
|
||||
exit_code = managed_processes[p].stop(retry=False)
|
||||
if (p == 'ui') or (EON and p == 'logcatd') or (p == 'soundd'):
|
||||
if (p == 'ui') or (EON and p == 'logcatd'):
|
||||
# TODO: make Qt UI exit gracefully
|
||||
continue
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ qt_env.Depends(assets, Glob('#selfdrive/assets/*', exclude=[assets, assets_src,
|
||||
asset_obj = qt_env.Object("assets", assets)
|
||||
|
||||
# build soundd
|
||||
qt_env.Program("_soundd", "soundd.cc", LIBS=base_libs)
|
||||
qt_env.Program("_soundd", "soundd.cc", LIBS=qt_libs)
|
||||
if GetOption('test'):
|
||||
qt_env.Program("tests/playsound", "tests/playsound.cc", LIBS=base_libs)
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QString>
|
||||
#include <QSoundEffect>
|
||||
|
||||
#include "selfdrive/ui/qt/util.h"
|
||||
#include "cereal/messaging/messaging.h"
|
||||
#include "selfdrive/common/util.h"
|
||||
#include "selfdrive/hardware/hw.h"
|
||||
@@ -14,6 +15,10 @@
|
||||
// TODO: detect when we can't play sounds
|
||||
// TODO: detect when we can't display the UI
|
||||
|
||||
void sigHandler(int s) {
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
class Sound : public QObject {
|
||||
public:
|
||||
explicit Sound(QObject *parent = 0) {
|
||||
@@ -100,9 +105,13 @@ private:
|
||||
};
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
qInstallMessageHandler(swagLogMessageHandler);
|
||||
setpriority(PRIO_PROCESS, 0, -20);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
std::signal(SIGINT, sigHandler);
|
||||
std::signal(SIGTERM, sigHandler);
|
||||
|
||||
Sound sound;
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user