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
{
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";
// 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)
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)
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_)
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));
if (resampled)
@ -240,20 +240,22 @@ bool Stream::getPlayerChunk(void* outputBuffer, const cs::usec& outputBufferDacT
return false;
}
static int64_t min_buffer = 0;
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::msec age = std::chrono::duration_cast<cs::msec>(TimeProvider::serverNow() - youngest + outputBufferDacTime);
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;
}
}
// calculate and log the estimated end to end latency
// static int64_t min_buffer = 0;
// 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::msec age = std::chrono::duration_cast<cs::msec>(TimeProvider::serverNow() - youngest + outputBufferDacTime);
// 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;
// }
// }
/// we have a chunk
/// 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)
{
LOG(DEBUG, LOG_TAG) << "outstanding async_write\n";
LOG(TRACE, LOG_TAG) << "outstanding async_write\n";
return;
}
send_next();

View file

@ -119,7 +119,7 @@ void PcmStream::setState(const ReaderState& newState)
{
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;
if (pcmListener_)
pcmListener_->onStateChanged(this, newState);