mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-06 21:01:42 +02:00
mutex
This commit is contained in:
parent
c0a1cb4210
commit
35e4cdb05d
2 changed files with 5 additions and 1 deletions
|
@ -50,6 +50,7 @@ void Controller::onException(ClientConnection* connection, const std::exception&
|
||||||
|
|
||||||
void Controller::onMessageReceived(ClientConnection* connection, const msg::BaseMessage& baseMessage, char* buffer)
|
void Controller::onMessageReceived(ClientConnection* connection, const msg::BaseMessage& baseMessage, char* buffer)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(receiveMutex_);
|
||||||
if (baseMessage.type == message_type::kWireChunk)
|
if (baseMessage.type == message_type::kWireChunk)
|
||||||
{
|
{
|
||||||
if (stream_ && decoder_)
|
if (stream_ && decoder_)
|
||||||
|
@ -95,6 +96,9 @@ void Controller::onMessageReceived(ClientConnection* connection, const msg::Base
|
||||||
|
|
||||||
logO << "Codec: " << headerChunk_->codec << "\n";
|
logO << "Codec: " << headerChunk_->codec << "\n";
|
||||||
decoder_.reset(nullptr);
|
decoder_.reset(nullptr);
|
||||||
|
stream_.reset(nullptr);
|
||||||
|
player_.reset(nullptr);
|
||||||
|
|
||||||
if (headerChunk_->codec == "pcm")
|
if (headerChunk_->codec == "pcm")
|
||||||
decoder_.reset(new PcmDecoder());
|
decoder_.reset(new PcmDecoder());
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
|
|
|
@ -69,7 +69,7 @@ private:
|
||||||
std::unique_ptr<Player> player_;
|
std::unique_ptr<Player> player_;
|
||||||
std::shared_ptr<msg::ServerSettings> serverSettings_;
|
std::shared_ptr<msg::ServerSettings> serverSettings_;
|
||||||
std::shared_ptr<msg::Header> headerChunk_;
|
std::shared_ptr<msg::Header> headerChunk_;
|
||||||
|
std::mutex receiveMutex_;
|
||||||
|
|
||||||
std::string exception_;
|
std::string exception_;
|
||||||
bool asyncException_;
|
bool asyncException_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue