diff --git a/logging/BUILD.gn b/logging/BUILD.gn index e9237b748a..1f700950b3 100644 --- a/logging/BUILD.gn +++ b/logging/BUILD.gn @@ -663,6 +663,7 @@ if (rtc_enable_protobuf) { "../modules/rtp_rtcp:rtp_rtcp_format", "../rtc_base:checks", "../rtc_base:protobuf_utils", + "../rtc_base:stringutils", "../test:rtp_test_utils", "//third_party/abseil-cpp/absl/flags:flag", "//third_party/abseil-cpp/absl/flags:parse", diff --git a/logging/rtc_event_log/rtc_event_log2rtp_dump.cc b/logging/rtc_event_log/rtc_event_log2rtp_dump.cc index 6a4dd58366..df30fe37e6 100644 --- a/logging/rtc_event_log/rtc_event_log2rtp_dump.cc +++ b/logging/rtc_event_log/rtc_event_log2rtp_dump.cc @@ -13,7 +13,6 @@ #include #include -#include // no-presubmit-check TODO(webrtc:8982): #include #include @@ -31,6 +30,7 @@ #include "modules/rtp_rtcp/source/rtp_header_extensions.h" #include "modules/rtp_rtcp/source/rtp_packet.h" #include "rtc_base/checks.h" +#include "rtc_base/string_to_number.h" #include "test/rtp_file_reader.h" #include "test/rtp_file_writer.h" @@ -76,19 +76,8 @@ using MediaType = webrtc::ParsedRtcEventLog::MediaType; // of the command-line flag. In this case, no value is written to the output // variable. absl::optional ParseSsrc(absl::string_view str) { - // If the input string starts with 0x or 0X it indicates a hexadecimal number. - uint32_t ssrc; - auto read_mode = std::dec; - if (str.size() > 2 && - (str.substr(0, 2) == "0x" || str.substr(0, 2) == "0X")) { - read_mode = std::hex; - str = str.substr(2); - } - std::stringstream ss(std::string{str}); - ss >> read_mode >> ssrc; - if (str.empty() || (!ss.fail() && ss.eof())) - return ssrc; - return absl::nullopt; + // Set `base` to 0 to allow detection of the "0x" prefix in case hex is used. + return rtc::StringToNumber(str, 0); } bool ShouldSkipStream(MediaType media_type, diff --git a/pc/peer_connection_simulcast_unittest.cc b/pc/peer_connection_simulcast_unittest.cc index 53dcd2d9dc..b2c0d715e8 100644 --- a/pc/peer_connection_simulcast_unittest.cc +++ b/pc/peer_connection_simulcast_unittest.cc @@ -12,7 +12,6 @@ #include #include #include -#include // no-presubmit-check TODO(webrtc:8982) #include #include #include @@ -89,19 +88,6 @@ using cricket::SimulcastDescription; using cricket::SimulcastLayer; using cricket::StreamParams; -namespace cricket { - -std::ostream& operator<<( // no-presubmit-check TODO(webrtc:8982) - std::ostream& os, // no-presubmit-check TODO(webrtc:8982) - const SimulcastLayer& layer) { - if (layer.is_paused) { - os << "~"; - } - return os << layer.rid; -} - -} // namespace cricket - namespace webrtc { class PeerConnectionSimulcastTests : public ::testing::Test { diff --git a/rtc_base/string_encode_unittest.cc b/rtc_base/string_encode_unittest.cc index f277d3a856..94e6b24a57 100644 --- a/rtc_base/string_encode_unittest.cc +++ b/rtc_base/string_encode_unittest.cc @@ -12,9 +12,8 @@ #include -#include // no-presubmit-check TODO(webrtc:8982) - #include "api/array_view.h" +#include "rtc_base/strings/string_format.h" #include "test/gtest.h" namespace rtc { @@ -273,14 +272,9 @@ TEST(ToString, SanityCheck) { EXPECT_EQ(ToString((unsigned long int)123), "123"); EXPECT_EQ(ToString((long long int)-123), "-123"); EXPECT_EQ(ToString((unsigned long long int)123), "123"); - - int i = 10; - int* p = &i; - std::ostringstream s; // no-presubmit-check TODO(webrtc:8982) - s << p; - EXPECT_EQ(s.str(), ToString(p)); - EXPECT_EQ(ToString(0.5), "0.5"); + int i = 10; + EXPECT_EQ(StringFormat("%p", &i), ToString(&i)); } template diff --git a/video/video_receive_stream2_unittest.cc b/video/video_receive_stream2_unittest.cc index 32ee1f18a6..d1cee24fc2 100644 --- a/video/video_receive_stream2_unittest.cc +++ b/video/video_receive_stream2_unittest.cc @@ -15,7 +15,6 @@ #include #include #include -#include // no-presubmit-check bugs.webrtc.org/8982 #include #include #include @@ -58,29 +57,6 @@ namespace webrtc { -// Printing SdpVideoFormat for gmock argument matchers. -void PrintTo(const SdpVideoFormat& value, std::ostream* os) { - *os << value.ToString(); -} - -void PrintTo(const RecordableEncodedFrame::EncodedResolution& value, - std::ostream* os) { - *os << value.width << "x" << value.height; -} - -inline std::ostream& operator<<(std::ostream& stream, Timestamp value) { - return stream << ToString(value); -} - -void PrintTo(const RecordableEncodedFrame& value, std::ostream* os) { - *os << "RecordableEncodedFrame(render_time=" << value.render_time() - << " resolution=" << ::testing::PrintToString(value.resolution()) << ")"; -} - -} // namespace webrtc - -namespace webrtc { - namespace { using test::video_frame_matchers::NtpTimestamp;