]> git.sesse.net Git - nageru/blobdiff - nageru/alsa_input.cpp
Fix a Clang 19 warning.
[nageru] / nageru / alsa_input.cpp
index 40fba43c12a19192a0c0fdcc07f430355df88619..f26a012d9836b250524fee8230e6beb7e1287339 100644 (file)
@@ -1,15 +1,18 @@
 #include "alsa_input.h"
 
 #include <alsa/error.h>
+#include <alsa/global.h>
+#include <alsa/pcm.h>
 #include <assert.h>
+#include <chrono>
 #include <errno.h>
+#include <pthread.h>
 #include <stdio.h>
-#include <unistd.h>
+#include <thread>
 #include <cstdint>
 
 #include "alsa_pool.h"
 #include "bmusb/bmusb.h"
-#include "shared/timebase.h"
 
 using namespace std;
 using namespace std::chrono;
@@ -174,6 +177,14 @@ void ALSAInput::stop_capture_thread()
 
 void ALSAInput::capture_thread_func()
 {
+       if (!done_init) {
+               char thread_name[16];
+               snprintf(thread_name, sizeof(thread_name), "ALSA_C_%d", internal_dev_index);
+               pthread_setname_np(pthread_self(), thread_name);
+
+               done_init = true;
+       }
+
        parent_pool->set_card_state(internal_dev_index, ALSAPool::Device::State::STARTING);
 
        // If the device hasn't been opened already, we need to do so