pw_properties_free(data.props);
data.props = NULL;
}
+
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
}
static int init(__attribute__((unused)) int argc, __attribute__((unused)) char **argv) {
die("pw: pw_properties_new() failed: %m");
}
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
pw_thread_loop_lock(data.mainloop);
if (pw_thread_loop_start(data.mainloop) != 0) {
data.sync = pw_core_sync(data.core, 0, data.sync);
pw_thread_loop_unlock(data.mainloop);
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
return 0;
}
static void start(int sample_rate, int sample_format) {
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
+
pw_thread_loop_lock(data.mainloop);
const struct spa_pod *params[1];
}
pw_thread_loop_unlock(data.mainloop);
+
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
}
static void stop() {
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
pw_thread_loop_lock(data.mainloop);
pw_stream_flush(data.stream, true);
pw_thread_loop_unlock(data.mainloop);
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
}
static void flush() {
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
pw_thread_loop_lock(data.mainloop);
pw_stream_flush(data.stream, false);
pw_thread_loop_unlock(data.mainloop);
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
}
static int play(void *buf, int samples) {
struct spa_buffer *spa_buffer;
struct spa_data *spa_data;
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
pw_thread_loop_lock(data.mainloop);
if (pw_stream_get_state(data.stream, NULL) == PW_STREAM_STATE_PAUSED)
pw_thread_loop_unlock(data.mainloop);
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
+
return 0;
}