Fix a bug when displayConfig was exiting when the soxr timer thread hadn't been started. Also quieten a cryptic dbus message.

This commit is contained in:
Mike Brady
2022-10-12 14:21:43 +01:00
parent 6e9ebe6e92
commit 62fca43f49
2 changed files with 22 additions and 5 deletions
+4 -3
View File
@@ -1129,10 +1129,11 @@ int start_dbus_service() {
void stop_dbus_service() {
debug(2, "stopping dbus service");
if (ownerID)
if (ownerID) {
g_bus_unown_name(ownerID);
else
debug(1, "Zero OwnerID for \"org.gnome.ShairportSync\".");
} else if (service_is_running != 0) {
debug(1, "Zero OwnerID for running \"org.gnome.ShairportSync\" dbus service.");
}
service_is_running = 0;
}
+18 -2
View File
@@ -171,6 +171,7 @@ int has_fltp_capable_aac_decoder(void) {
#ifdef CONFIG_SOXR
pthread_t soxr_time_check_thread;
int soxr_time_check_thread_started = 0;
void *soxr_time_check(__attribute__((unused)) void *arg) {
const int buffer_length = 352;
int32_t inbuffer[buffer_length * 2];
@@ -1541,6 +1542,7 @@ void exit_function() {
#ifdef CONFIG_DBUS_INTERFACE
debug(2, "Stopping D-Bus service");
stop_dbus_service();
debug(2, "Stopping D-Bus service done");
#endif
if (g_main_loop) {
debug(2, "Stopping D-Bus Loop Thread");
@@ -1551,35 +1553,48 @@ void exit_function() {
// so don't wait for it
if (type_of_exit_cleanup != TOE_dbus)
pthread_join(dbus_thread, NULL);
debug(2, "Stopping D-Bus Loop Thread Done");
}
#endif
#ifdef CONFIG_DACP_CLIENT
debug(2, "Stopping DACP Monitor");
dacp_monitor_stop();
debug(2, "Stopping DACP Monitor Done");
#endif
#ifdef CONFIG_METADATA_HUB
debug(2, "Stopping metadata hub");
metadata_hub_stop();
debug(2, "Stopping metadata done");
#endif
#ifdef CONFIG_METADATA
debug(2, "Stopping metadata");
metadata_stop(); // close down the metadata pipe
debug(2, "Stopping metadata done");
#endif
debug(2, "Stopping the activity monitor.");
activity_monitor_stop(0);
debug(2, "Stopping the activity monitor done.");
if ((config.output) && (config.output->deinit)) {
debug(2, "Deinitialise the audio backend.");
config.output->deinit();
debug(2, "Deinitialise the audio backend done.");
}
#ifdef CONFIG_SOXR
// be careful -- not sure if the thread can be cancelled cleanly, so wait for it to shut down
debug(2, "Waiting for SoXr timecheck to terminate...");
pthread_join(soxr_time_check_thread, NULL);
if (soxr_time_check_thread_started != 0) {
debug(1, "Waiting for SoXr timecheck to terminate...");
pthread_join(soxr_time_check_thread, NULL);
soxr_time_check_thread_started = 0;
debug(1, "Waiting for SoXr timecheck to terminate done");
}
#endif
if (conns)
@@ -2354,6 +2369,7 @@ int main(int argc, char **argv) {
#ifdef CONFIG_SOXR
pthread_create(&soxr_time_check_thread, NULL, &soxr_time_check, NULL);
soxr_time_check_thread_started = 1;
#endif
/*