Include sign for infinity in ToString for data units.

Bug: webrtc:9709
Change-Id: I8a4ee0797dca25dc7c3c414f24ada34c8bcbd7f8
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/125660
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26966}
This commit is contained in:
Sebastian Jansson
2019-03-05 09:14:02 +01:00
committed by Commit Bot
parent 44ce4b46f4
commit bd7ed4bd5e
3 changed files with 12 additions and 6 deletions

View File

@ -18,8 +18,10 @@ namespace webrtc {
std::string ToString(DataRate value) { std::string ToString(DataRate value) {
char buf[64]; char buf[64];
rtc::SimpleStringBuilder sb(buf); rtc::SimpleStringBuilder sb(buf);
if (value.IsInfinite()) { if (value.IsPlusInfinity()) {
sb << "inf bps"; sb << "+inf bps";
} else if (value.IsMinusInfinity()) {
sb << "-inf bps";
} else { } else {
if (value.bps() == 0 || value.bps() % 1000 != 0) { if (value.bps() == 0 || value.bps() % 1000 != 0) {
sb << value.bps() << " bps"; sb << value.bps() << " bps";

View File

@ -18,8 +18,10 @@ namespace webrtc {
std::string ToString(DataSize value) { std::string ToString(DataSize value) {
char buf[64]; char buf[64];
rtc::SimpleStringBuilder sb(buf); rtc::SimpleStringBuilder sb(buf);
if (value.IsInfinite()) { if (value.IsPlusInfinity()) {
sb << "inf bytes"; sb << "+inf bytes";
} else if (value.IsMinusInfinity()) {
sb << "-inf bytes";
} else { } else {
sb << value.bytes() << " bytes"; sb << value.bytes() << " bytes";
} }

View File

@ -17,8 +17,10 @@ namespace webrtc {
std::string ToString(Timestamp value) { std::string ToString(Timestamp value) {
char buf[64]; char buf[64];
rtc::SimpleStringBuilder sb(buf); rtc::SimpleStringBuilder sb(buf);
if (value.IsInfinite()) { if (value.IsPlusInfinity()) {
sb << "inf ms"; sb << "+inf ms";
} else if (value.IsMinusInfinity()) {
sb << "-inf ms";
} else { } else {
if (value.ms() % 1000 == 0) if (value.ms() % 1000 == 0)
sb << value.seconds() << " s"; sb << value.seconds() << " s";