mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-13 08:11:44 +02:00
Make pa_ready thread safe
This commit is contained in:
parent
21665d163e
commit
f08d3be836
2 changed files with 3 additions and 1 deletions
|
@ -264,6 +264,7 @@ void PulsePlayer::start()
|
|||
throw SnapException("Timeout while waiting for PulseAudio to become ready");
|
||||
if (pa_mainloop_iterate(pa_ml_, 1, nullptr) < 0)
|
||||
throw SnapException("Error while waiting for PulseAudio to become ready: " + std::string(pa_strerror(pa_context_errno(pa_ctx_))));
|
||||
this_thread::sleep_for(1ms);
|
||||
}
|
||||
|
||||
if (pa_ready_ == 2)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "player.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <pulse/pulseaudio.h>
|
||||
|
@ -55,7 +56,7 @@ protected:
|
|||
|
||||
std::chrono::microseconds latency_;
|
||||
int underflows_ = 0;
|
||||
int pa_ready_ = 0;
|
||||
std::atomic<int> pa_ready_;
|
||||
|
||||
pa_buffer_attr bufattr_;
|
||||
pa_sample_spec pa_ss_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue