}
mStopStreamingThread.store(false);
+ if (mBackgroundVolumeThread.joinable()) {
+ MWR_LOGD("mBackgroundVolumeThread is joinable, trying join()");
+ try {
+ mBackgroundVolumeThread.join();
+ } catch (std::exception &e) {
+ MWR_LOGE("Exception thrown : %s", e.what());
+ }
+ }
+
sound_manager_remove_focus_state_watch_cb(mSoundFocusWatchId);
return 0;
mStopStreamingThread.store(false);
}
-void CAudioManager::set_background_volume(double ratio)
+static void set_background_volume_thread_func(double ratio)
{
+ MWR_LOGI("[ENTER]");
dependency_resolver_set_background_volume(ratio);
}
+void CAudioManager::set_background_volume(double ratio)
+{
+ if (mBackgroundVolumeThread.joinable()) {
+ mBackgroundVolumeThread.join();
+ }
+ mBackgroundVolumeThread = thread(&set_background_volume_thread_func, ratio);
+}
+
} // wakeup
} // multiassistant