diff --git a/client/decoder/opus_decoder.cpp b/client/decoder/opus_decoder.cpp index 4cc86651..a3d3474f 100644 --- a/client/decoder/opus_decoder.cpp +++ b/client/decoder/opus_decoder.cpp @@ -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 diff --git a/client/player/alsa_player.cpp b/client/player/alsa_player.cpp index 5018eb2c..cff7aac3 100644 --- a/client/player/alsa_player.cpp +++ b/client/player/alsa_player.cpp @@ -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))); diff --git a/client/stream.cpp b/client/stream.cpp index ee53bc7f..18baa587 100644 --- a/client/stream.cpp +++ b/client/stream.cpp @@ -102,7 +102,7 @@ void Stream::addChunk(unique_ptr 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 recent_; - if (chunks_.back_copy(recent_)) - { - cs::nsec req_chunk_duration = cs::nsec(static_cast(frames / format_.nsRate())); - auto youngest = recent_->end() - req_chunk_duration; - cs::msec age = std::chrono::duration_cast(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(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 recent_; + // if (chunks_.back_copy(recent_)) + // { + // cs::nsec req_chunk_duration = cs::nsec(static_cast(frames / format_.nsRate())); + // auto youngest = recent_->end() - req_chunk_duration; + // cs::msec age = std::chrono::duration_cast(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(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 diff --git a/server/stream_session.cpp b/server/stream_session.cpp index 4446da7c..9b16a8dc 100644 --- a/server/stream_session.cpp +++ b/server/stream_session.cpp @@ -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(); diff --git a/server/streamreader/pcm_stream.cpp b/server/streamreader/pcm_stream.cpp index aecbdc40..4130b3d2 100644 --- a/server/streamreader/pcm_stream.cpp +++ b/server/streamreader/pcm_stream.cpp @@ -119,7 +119,7 @@ void PcmStream::setState(const ReaderState& newState) { if (newState != state_) { - LOG(DEBUG, LOG_TAG) << "State changed: " << static_cast(state_) << " => " << static_cast(newState) << "\n"; + LOG(INFO, LOG_TAG) << "State changed: " << static_cast(state_) << " => " << static_cast(newState) << "\n"; state_ = newState; if (pcmListener_) pcmListener_->onStateChanged(this, newState);