Change some log levels

This commit is contained in:
badaix 2020-04-29 17:32:42 +02:00
parent 9bb1c4a041
commit 0996c04dca
3 changed files with 8 additions and 6 deletions

View file

@ -94,7 +94,7 @@ bool FlacDecoder::decode(msg::PcmChunk* chunk)
double diffMs = static_cast<double>(cacheInfo_.cachedBlocks_) / (static_cast<double>(cacheInfo_.sampleRate_) / 1000.); double diffMs = static_cast<double>(cacheInfo_.cachedBlocks_) / (static_cast<double>(cacheInfo_.sampleRate_) / 1000.);
auto us = static_cast<uint64_t>(diffMs * 1000.); auto us = static_cast<uint64_t>(diffMs * 1000.);
tv diff(static_cast<int32_t>(us / 1000000), static_cast<int32_t>(us % 1000000)); tv diff(static_cast<int32_t>(us / 1000000), static_cast<int32_t>(us % 1000000));
LOG(DEBUG) << "Cached: " << cacheInfo_.cachedBlocks_ << ", " << diffMs << "ms, " << diff.sec << "s, " << diff.usec << "us\n"; LOG(TRACE) << "Cached: " << cacheInfo_.cachedBlocks_ << ", " << diffMs << "ms, " << diff.sec << "s, " << diff.usec << "us\n";
chunk->timestamp = chunk->timestamp - diff; chunk->timestamp = chunk->timestamp - diff;
} }
return true; return true;

View file

@ -32,6 +32,7 @@ namespace decoder
/// Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes. /// Passing in a duration of less than 10 ms (480 samples at 48 kHz) will prevent the encoder from using the LPC or hybrid modes.
static constexpr int const_max_frame_size = 2880; static constexpr int const_max_frame_size = 2880;
static constexpr auto LOG_TAG = "OpusDecoder";
OpusDecoder::OpusDecoder() : Decoder(), dec_(nullptr) OpusDecoder::OpusDecoder() : Decoder(), dec_(nullptr)
{ {
@ -56,7 +57,7 @@ bool OpusDecoder::decode(msg::PcmChunk* chunk)
if (pcm_.size() < const_max_frame_size * sample_format_.channels()) if (pcm_.size() < const_max_frame_size * sample_format_.channels())
{ {
pcm_.resize(pcm_.size() * 2); pcm_.resize(pcm_.size() * 2);
LOG(INFO) << "OPUS encoding buffer too small, resizing to " << pcm_.size() / sample_format_.channels() << " samples per channel\n"; LOG(DEBUG, LOG_TAG) << "OPUS encoding buffer too small, resizing to " << pcm_.size() / sample_format_.channels() << " samples per channel\n";
} }
else else
break; break;
@ -64,12 +65,13 @@ bool OpusDecoder::decode(msg::PcmChunk* chunk)
if (frame_size < 0) if (frame_size < 0)
{ {
LOG(ERROR) << "Failed to decode chunk: " << opus_strerror(frame_size) << ", IN size: " << chunk->payloadSize << ", OUT size: " << pcm_.size() << '\n'; LOG(ERROR, LOG_TAG) << "Failed to decode chunk: " << opus_strerror(frame_size) << ", IN size: " << chunk->payloadSize << ", OUT size: " << pcm_.size()
<< '\n';
return false; return false;
} }
else else
{ {
LOG(DEBUG) << "Decoded chunk: size " << chunk->payloadSize << " bytes, decoded " << frame_size << " samples" << '\n'; LOG(DEBUG, LOG_TAG) << "Decoded chunk: size " << chunk->payloadSize << " bytes, decoded " << frame_size << " samples" << '\n';
// copy encoded data to chunk // copy encoded data to chunk
chunk->payloadSize = frame_size * sample_format_.channels() * sizeof(opus_int16); chunk->payloadSize = frame_size * sample_format_.channels() * sizeof(opus_int16);
@ -101,7 +103,7 @@ SampleFormat OpusDecoder::setHeader(msg::CodecHeader* chunk)
memcpy(&channels, chunk->payload + 10, sizeof(channels)); memcpy(&channels, chunk->payload + 10, sizeof(channels));
sample_format_.setFormat(SWAP_32(rate), SWAP_16(bits), SWAP_16(channels)); sample_format_.setFormat(SWAP_32(rate), SWAP_16(bits), SWAP_16(channels));
LOG(DEBUG) << "Opus sampleformat: " << sample_format_.getFormat() << "\n"; LOG(DEBUG, LOG_TAG) << "Opus sampleformat: " << sample_format_.getFormat() << "\n";
// create the decoder // create the decoder
int error; int error;

View file

@ -312,7 +312,7 @@ int main(int argc, char* argv[])
if (!ec) if (!ec)
LOG(INFO) << "Received signal " << signal << ": " << strsignal(signal) << "\n"; LOG(INFO) << "Received signal " << signal << ": " << strsignal(signal) << "\n";
else else
LOG(INFO) << "Failed to wait for signal: " << ec << "\n"; LOG(INFO) << "Failed to wait for signal, error: " << ec.message() << "\n";
io_context.stop(); io_context.stop();
}); });