mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-01 23:59:43 +02:00
Fix thread races
This commit is contained in:
parent
2efd00d8ef
commit
ee158b521d
4 changed files with 5 additions and 13 deletions
|
@ -295,7 +295,6 @@ json PcmStream::toJson() const
|
|||
{"status", to_string(state_)},
|
||||
};
|
||||
|
||||
j["metadata"] = metadata_.toJson();
|
||||
j["properties"] = properties_.toJson();
|
||||
|
||||
return j;
|
||||
|
@ -308,13 +307,6 @@ void PcmStream::addListener(PcmListener* pcmListener)
|
|||
}
|
||||
|
||||
|
||||
const Metatags& PcmStream::getMetadata() const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
return metadata_;
|
||||
}
|
||||
|
||||
|
||||
const Properties& PcmStream::getProperties() const
|
||||
{
|
||||
// std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
|
@ -448,7 +440,7 @@ void PcmStream::play(ResultHandler handler)
|
|||
|
||||
void PcmStream::setProperties(const Properties& properties)
|
||||
{
|
||||
// std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
Properties props = properties;
|
||||
// Missing metadata means the data didn't change, so
|
||||
// enrich the new properites with old metadata
|
||||
|
|
|
@ -134,7 +134,6 @@ public:
|
|||
virtual const SampleFormat& getSampleFormat() const;
|
||||
virtual std::string getCodec() const;
|
||||
|
||||
const Metatags& getMetadata() const;
|
||||
const Properties& getProperties() const;
|
||||
|
||||
// Setter for properties
|
||||
|
@ -189,7 +188,6 @@ protected:
|
|||
std::unique_ptr<encoder::Encoder> encoder_;
|
||||
std::string name_;
|
||||
std::atomic<ReaderState> state_;
|
||||
Metatags metadata_;
|
||||
Properties properties_;
|
||||
boost::asio::io_context& ioc_;
|
||||
ServerSettings server_settings_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue