mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 05:40:27 +00:00
Use logger again
Use logger again where there is output printed in a color or highlighted.
This commit is contained in:
@@ -880,9 +880,7 @@ static void *asend_compute_and_print_stats(void *arg) {
|
||||
for (int i = 0; i < d->frame.get_channel_count(); ++i) {
|
||||
double rms, peak;
|
||||
rms = calculate_rms(&d->frame, i, &peak);
|
||||
if (log_level >= LOG_LEVEL_INFO) {
|
||||
cerr << "[Audio sender] Channel " << i << " - volume: " << setprecision(2) << fixed << fg::green << style::bold << 20 * log(rms) / log(10) << style::reset << fg::reset << " dBFS RMS, " << fg::green << style::bold << 20 * log(peak) / log(10) << style::reset << fg::reset << " dBFS peak.\n";
|
||||
}
|
||||
LOG(LOG_LEVEL_INFO) << "[Audio sender] Channel " << i << " - volume: " << setprecision(2) << fixed << fg::green << style::bold << 20 * log(rms) / log(10) << style::reset << fg::reset << " dBFS RMS, " << fg::green << style::bold << 20 * log(peak) / log(10) << style::reset << fg::reset << " dBFS peak.\n";
|
||||
}
|
||||
|
||||
delete d;
|
||||
|
||||
@@ -70,12 +70,10 @@
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
using rang::fg;
|
||||
using rang::style;
|
||||
using std::cerr;
|
||||
using std::fixed;
|
||||
using std::ostringstream;
|
||||
using std::setprecision;
|
||||
@@ -375,9 +373,7 @@ static void *adec_compute_and_print_stats(void *arg) {
|
||||
for (int i = 0; i < d->frame.get_channel_count(); ++i) {
|
||||
double rms, peak;
|
||||
rms = calculate_rms(&d->frame, i, &peak);
|
||||
if (log_level >= LOG_LEVEL_INFO) {
|
||||
std::cerr << "[Audio decoder] Channel " << i << " - volume: " << fg::magenta << style::bold << setprecision(2) << fixed << 20 * log(rms) / log(10) << style::reset << fg::reset << " dBFS RMS, " << fg::magenta << style::bold << 20 * log(peak) / log(10) << style::reset << fg::reset << " dBFS peak.\n";
|
||||
}
|
||||
LOG(LOG_LEVEL_INFO) << "[Audio decoder] Channel " << i << " - volume: " << fg::magenta << style::bold << setprecision(2) << fixed << 20 * log(rms) / log(10) << style::reset << fg::reset << " dBFS RMS, " << fg::magenta << style::bold << 20 * log(peak) / log(10) << style::reset << fg::reset << " dBFS peak.\n";
|
||||
}
|
||||
|
||||
delete d;
|
||||
|
||||
@@ -76,7 +76,6 @@ static_assert(STATS_INTERVAL % (sizeof(unsigned long long) * CHAR_BIT) == 0,
|
||||
"STATS_INTERVAL must be divisible by (sizeof(ull) * CHAR_BIT)");
|
||||
|
||||
using rang::fg;
|
||||
using std::cerr;
|
||||
using std::dec;
|
||||
using std::hex;
|
||||
using std::max;
|
||||
@@ -381,18 +380,16 @@ void pbuf_insert(struct pbuf *playout_buf, rtp_packet * pkt)
|
||||
if ((pkt->ts - playout_buf->last_display_ts) > 90000 * 5 &&
|
||||
playout_buf->expected_pkts > 0) {
|
||||
// print stats
|
||||
if (log_level >= LOG_LEVEL_INFO) {
|
||||
double loss_pct = (double) playout_buf->received_pkts /
|
||||
playout_buf->expected_pkts * 100.0;
|
||||
cerr << "SSRC " << hex << setfill('0') << setw(8) <<
|
||||
pkt->ssrc << ": " << setw(0) << dec
|
||||
<< playout_buf->received_pkts << "/"
|
||||
<< playout_buf->expected_pkts << " packets received ("
|
||||
<< (loss_pct < 100.0 ? fg::red : fg::reset)
|
||||
<< setprecision(4) << loss_pct << "%" << fg::reset
|
||||
<< "), max loss " << playout_buf->longest_gap
|
||||
<< (playout_buf->out_of_order_pkts ? ", out-of-order pkts" : "") << ".\n";
|
||||
}
|
||||
double loss_pct = (double) playout_buf->received_pkts /
|
||||
playout_buf->expected_pkts * 100.0;
|
||||
LOG(LOG_LEVEL_INFO) << "SSRC " << hex << setfill('0') << setw(8) <<
|
||||
pkt->ssrc << ": " << setw(0) << dec
|
||||
<< playout_buf->received_pkts << "/"
|
||||
<< playout_buf->expected_pkts << " packets received ("
|
||||
<< (loss_pct < 100.0 ? fg::red : fg::reset)
|
||||
<< setprecision(4) << loss_pct << "%" << fg::reset
|
||||
<< "), max loss " << playout_buf->longest_gap
|
||||
<< (playout_buf->out_of_order_pkts ? ", out-of-order pkts" : "") << ".\n";
|
||||
playout_buf->expected_pkts = playout_buf->received_pkts = 0;
|
||||
playout_buf->last_display_ts = pkt->ts;
|
||||
playout_buf->longest_gap = 0;
|
||||
|
||||
@@ -211,10 +211,16 @@ struct reported_statistics_cumul {
|
||||
unsigned long long int nano_per_frame_expected = 0;
|
||||
unsigned long int reported_frames = 0;
|
||||
void print() {
|
||||
if (log_level < LOG_LEVEL_INFO) {
|
||||
return;
|
||||
ostringstream fec;
|
||||
if (fec_ok + fec_nok + fec_corrected > 0) {
|
||||
fec << " FEC noerr/OK/NOK: "
|
||||
<< style::bold << fec_ok << style::reset
|
||||
<< "/"
|
||||
<< style::bold << fec_corrected << style::reset
|
||||
<< "/"
|
||||
<< style::bold << fec_nok << style::reset;
|
||||
}
|
||||
cerr << style::underline << "Video dec stats" << style::reset << " (cumulative): "
|
||||
LOG(LOG_LEVEL_INFO) << style::underline << "Video dec stats" << style::reset << " (cumulative): "
|
||||
<< style::bold << displayed + dropped + missing << style::reset
|
||||
<< " total / "
|
||||
<< style::bold << displayed << style::reset
|
||||
@@ -224,16 +230,7 @@ struct reported_statistics_cumul {
|
||||
<< style::bold << corrupted << style::reset
|
||||
<< " corr / "
|
||||
<< style::bold << missing << style::reset
|
||||
<< " missing.";
|
||||
if (fec_ok + fec_nok + fec_corrected > 0) {
|
||||
cerr << " FEC noerr/OK/NOK: "
|
||||
<< style::bold << fec_ok << style::reset
|
||||
<< "/"
|
||||
<< style::bold << fec_corrected << style::reset
|
||||
<< "/"
|
||||
<< style::bold << fec_nok << style::reset;
|
||||
}
|
||||
cerr << "\n";
|
||||
<< " missing." << fec.str() << "\n";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user