Remove more sstream deps

Bug: webrtc:8982
Change-Id: I7e1e2a8515b84567d6fe8127ff0e2806a2a4714a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/356400
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42610}
This commit is contained in:
Tommi 2024-07-09 10:29:44 +02:00 committed by WebRTC LUCI CQ
parent b1ebcfbfd6
commit 187a4363c0
5 changed files with 7 additions and 61 deletions

View File

@ -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",

View File

@ -13,7 +13,6 @@
#include <iostream>
#include <memory>
#include <sstream> // no-presubmit-check TODO(webrtc:8982):
#include <string>
#include <vector>
@ -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<uint32_t> 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<uint32_t>(str, 0);
}
bool ShouldSkipStream(MediaType media_type,

View File

@ -12,7 +12,6 @@
#include <iterator>
#include <map>
#include <memory>
#include <ostream> // no-presubmit-check TODO(webrtc:8982)
#include <string>
#include <utility>
#include <vector>
@ -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 {

View File

@ -12,9 +12,8 @@
#include <string.h>
#include <sstream> // 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 <typename T>

View File

@ -15,7 +15,6 @@
#include <deque>
#include <limits>
#include <memory>
#include <ostream> // no-presubmit-check bugs.webrtc.org/8982
#include <queue>
#include <tuple>
#include <utility>
@ -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;