Skip to content

Commit

Permalink
Update receiver bandwidth print to respect pf:json
Browse files Browse the repository at this point in the history
The receiver mode in stransmit did not respect the json print format
request.
  • Loading branch information
Aaron Boushley authored and boushley committed Jun 1, 2018
1 parent 739f91d commit 25e1ed9
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions apps/transmitmedia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ void PrintSrtStats(int sid, const PerfMonType& mon)
cerr << output.str() << std::flush;
}

static void PrintSrtBandwidth(double mbpsBandwidth)
{
std::ostringstream output;

if (printformat_json) {
output << "{\"bandwidth\":" << mbpsBandwidth << '}' << endl;
} else {
output << "+++/+++SRT BANDWIDTH: " << mbpsBandwidth << endl;
}

cerr << output.str() << std::flush;
}


void SrtCommon::InitParameters(string host, map<string,string> par)
{
Expand Down Expand Up @@ -601,7 +614,7 @@ bool SrtSource::Read(size_t chunk, bytevector& data)
clear_stats = false;
if ( transmit_bw_report && (counter % transmit_bw_report) == transmit_bw_report - 1 )
{
cerr << "+++/+++SRT BANDWIDTH: " << perf.mbpsBandwidth << endl;
PrintSrtBandwidth(perf.mbpsBandwidth);
}
if ( transmit_stats_report && (counter % transmit_stats_report) == transmit_stats_report - 1)
{
Expand Down Expand Up @@ -647,11 +660,7 @@ bool SrtTarget::Write(const bytevector& data)
clear_stats = false;
if ( transmit_bw_report && (counter % transmit_bw_report) == transmit_bw_report - 1 )
{
if (printformat_json) {
cerr << "{\"bandwidth\":" << perf.mbpsBandwidth << '}' << endl;
} else {
cerr << "+++/+++SRT BANDWIDTH: " << perf.mbpsBandwidth << endl;
}
PrintSrtBandwidth(perf.mbpsBandwidth);
}
if ( transmit_stats_report && (counter % transmit_stats_report) == transmit_stats_report - 1)
{
Expand Down

0 comments on commit 25e1ed9

Please sign in to comment.