mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-15 07:57:07 +03:00
update CSpot + clear audio buffer when changing track
This commit is contained in:
@@ -115,6 +115,7 @@ std::shared_ptr<AudioChunk> MercuryManager::fetchAudioChunk(std::vector<uint8_t>
|
||||
this->session->shanConn->sendPacket(static_cast<uint8_t>(MercuryType::AUDIO_CHUNK_REQUEST_COMMAND), buffer);
|
||||
|
||||
// Used for broken connection detection
|
||||
CSPOT_LOG(info, "requesting Chunk %hu", this->audioChunkSequence - 1);
|
||||
this->lastRequestTimestamp = this->timeProvider->getSyncedTimestamp();
|
||||
return this->audioChunkManager->registerNewChunk(this->audioChunkSequence - 1, audioKey, startPos, endPos);
|
||||
}
|
||||
@@ -208,16 +209,19 @@ void MercuryManager::updateQueue() {
|
||||
if (queueSemaphore->twait() == 0) {
|
||||
if (this->queue.size() > 0)
|
||||
{
|
||||
auto packet = std::move(this->queue[0]);
|
||||
std::unique_ptr<Packet> packet = std::move(this->queue[0]);
|
||||
this->queue.erase(this->queue.begin());
|
||||
if(packet == nullptr){
|
||||
return;
|
||||
}
|
||||
CSPOT_LOG(debug, "Received packet with code %d of length %d", packet->command, packet->data.size());
|
||||
switch (static_cast<MercuryType>(packet->command))
|
||||
{
|
||||
case MercuryType::COUNTRY_CODE_RESPONSE:
|
||||
{
|
||||
|
||||
countryCode = std::string(packet->data.begin(), packet->data.end());
|
||||
CSPOT_LOG(debug, "Received country code: %s", countryCode.c_str());
|
||||
memcpy(countryCode, packet->data.data(), 2);
|
||||
CSPOT_LOG(debug, "Received country code: %.2s", countryCode);
|
||||
break;
|
||||
}
|
||||
case MercuryType::AUDIO_KEY_FAILURE_RESPONSE:
|
||||
|
||||
Reference in New Issue
Block a user