Change some log levels

This commit is contained in:
badaix 2020-08-16 14:44:22 +02:00
parent aee4f3144b
commit 9c01849a64
5 changed files with 21 additions and 19 deletions

View file

@ -71,7 +71,7 @@ bool OpusDecoder::decode(msg::PcmChunk* chunk)
} }
else else
{ {
LOG(DEBUG, LOG_TAG) << "Decode chunk: " << decoded_frames << " frames, size: " << chunk->payloadSize LOG(TRACE, LOG_TAG) << "Decode chunk: " << decoded_frames << " frames, size: " << chunk->payloadSize
<< " bytes, decoded: " << decoded_frames * sample_format_.frameSize() << " bytes\n"; << " bytes, decoded: " << decoded_frames * sample_format_.frameSize() << " bytes\n";
// copy encoded data to chunk // copy encoded data to chunk

View file

@ -329,7 +329,7 @@ void AlsaPlayer::initAlsa()
} }
if ((err = snd_pcm_hw_params_set_channels(handle_, params, channels)) < 0) if ((err = snd_pcm_hw_params_set_channels(handle_, params, channels)) < 0)
throw SnapException("Can't set channels number: " + string(snd_strerror(err))); throw SnapException("Can't set channel count: " + string(snd_strerror(err)));
if ((err = snd_pcm_hw_params_set_rate_near(handle_, params, &rate, nullptr)) < 0) if ((err = snd_pcm_hw_params_set_rate_near(handle_, params, &rate, nullptr)) < 0)
throw SnapException("Can't set rate: " + string(snd_strerror(err))); throw SnapException("Can't set rate: " + string(snd_strerror(err)));

View file

@ -102,7 +102,7 @@ void Stream::addChunk(unique_ptr<msg::PcmChunk> chunk)
if (age > 5s + bufferMs_) if (age > 5s + bufferMs_)
return; return;
LOG(TRACE, LOG_TAG) << "new chunk: " << chunk->durationMs() << " ms, age: " << age.count() << " ms, Chunks: " << chunks_.size() << "\n"; // LOG(TRACE, LOG_TAG) << "new chunk: " << chunk->durationMs() << " ms, age: " << age.count() << " ms, Chunks: " << chunks_.size() << "\n";
auto resampled = resampler_->resample(std::move(chunk)); auto resampled = resampler_->resample(std::move(chunk));
if (resampled) if (resampled)
@ -240,20 +240,22 @@ bool Stream::getPlayerChunk(void* outputBuffer, const cs::usec& outputBufferDacT
return false; return false;
} }
static int64_t min_buffer = 0; // calculate and log the estimated end to end latency
std::shared_ptr<msg::PcmChunk> recent_; // static int64_t min_buffer = 0;
if (chunks_.back_copy(recent_)) // std::shared_ptr<msg::PcmChunk> recent_;
{ // if (chunks_.back_copy(recent_))
cs::nsec req_chunk_duration = cs::nsec(static_cast<cs::nsec::rep>(frames / format_.nsRate())); // {
auto youngest = recent_->end() - req_chunk_duration; // cs::nsec req_chunk_duration = cs::nsec(static_cast<cs::nsec::rep>(frames / format_.nsRate()));
cs::msec age = std::chrono::duration_cast<cs::msec>(TimeProvider::serverNow() - youngest + outputBufferDacTime); // auto youngest = recent_->end() - req_chunk_duration;
min_buffer = std::max(min_buffer, age.count()); // cs::msec age = std::chrono::duration_cast<cs::msec>(TimeProvider::serverNow() - youngest + outputBufferDacTime);
if (now != lastUpdate_) // min_buffer = std::max(min_buffer, age.count());
{ // if (now != lastUpdate_)
LOG(TRACE, LOG_TAG) << "getPlayerChunk duration: " << std::chrono::duration_cast<std::chrono::milliseconds>(req_chunk_duration).count() << ", min buffer: " << min_buffer << "\n"; // {
min_buffer = 0; // LOG(TRACE, LOG_TAG) << "getPlayerChunk duration: " << std::chrono::duration_cast<std::chrono::milliseconds>(req_chunk_duration).count()
} // << ", min buffer: " << min_buffer << "\n";
} // min_buffer = 0;
// }
// }
/// we have a chunk /// we have a chunk
/// age = chunk age (server now - rec time: some positive value) - buffer (e.g. 1000ms) + time to DAC /// age = chunk age (server now - rec time: some positive value) - buffer (e.g. 1000ms) + time to DAC

View file

@ -86,7 +86,7 @@ void StreamSession::send(shared_const_buffer const_buf)
if (messages_.size() > 1) if (messages_.size() > 1)
{ {
LOG(DEBUG, LOG_TAG) << "outstanding async_write\n"; LOG(TRACE, LOG_TAG) << "outstanding async_write\n";
return; return;
} }
send_next(); send_next();

View file

@ -119,7 +119,7 @@ void PcmStream::setState(const ReaderState& newState)
{ {
if (newState != state_) if (newState != state_)
{ {
LOG(DEBUG, LOG_TAG) << "State changed: " << static_cast<int>(state_) << " => " << static_cast<int>(newState) << "\n"; LOG(INFO, LOG_TAG) << "State changed: " << static_cast<int>(state_) << " => " << static_cast<int>(newState) << "\n";
state_ = newState; state_ = newState;
if (pcmListener_) if (pcmListener_)
pcmListener_->onStateChanged(this, newState); pcmListener_->onStateChanged(this, newState);