replace stringstream in call/

Bug: webrtc:8982
Change-Id: Ib4149bd421afa9018dcd76c60d0a6acfc3b764ff
Reviewed-on: https://webrtc-review.googlesource.com/64881
Commit-Queue: Oleh Prypin <oprypin@webrtc.org>
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22737}
diff --git a/call/audio_send_stream.cc b/call/audio_send_stream.cc
index 1c08c2e..e2cf20c 100644
--- a/call/audio_send_stream.cc
+++ b/call/audio_send_stream.cc
@@ -11,6 +11,7 @@
 #include "call/audio_send_stream.h"
 #include "rtc_base/stringencode.h"
 #include "rtc_base/strings/audio_format_to_string.h"
+#include "rtc_base/strings/string_builder.h"
 
 namespace webrtc {
 
@@ -23,7 +24,8 @@
 AudioSendStream::Config::~Config() = default;
 
 std::string AudioSendStream::Config::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{rtp: " << rtp.ToString();
   ss << ", send_transport: " << (send_transport ? "(Transport)" : "null");
   ss << ", min_bitrate_bps: " << min_bitrate_bps;
@@ -39,7 +41,8 @@
 AudioSendStream::Config::Rtp::~Rtp() = default;
 
 std::string AudioSendStream::Config::Rtp::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{ssrc: " << ssrc;
   ss << ", extensions: [";
   for (size_t i = 0; i < extensions.size(); ++i) {
@@ -62,7 +65,8 @@
 AudioSendStream::Config::SendCodecSpec::~SendCodecSpec() = default;
 
 std::string AudioSendStream::Config::SendCodecSpec::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{nack_enabled: " << (nack_enabled ? "true" : "false");
   ss << ", transport_cc_enabled: " << (transport_cc_enabled ? "true" : "false");
   ss << ", cng_payload_type: "
diff --git a/call/call.cc b/call/call.cc
index 54784eb..aee43aa 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -55,6 +55,7 @@
 #include "rtc_base/rate_limiter.h"
 #include "rtc_base/sequenced_task_checker.h"
 #include "rtc_base/synchronization/rw_lock_wrapper.h"
+#include "rtc_base/strings/string_builder.h"
 #include "rtc_base/task_queue.h"
 #include "rtc_base/thread_annotations.h"
 #include "rtc_base/trace_event.h"
@@ -379,7 +380,8 @@
 }  // namespace internal
 
 std::string Call::Stats::ToString(int64_t time_ms) const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "Call stats: " << time_ms << ", {";
   ss << "send_bw_bps: " << send_bandwidth_bps << ", ";
   ss << "recv_bw_bps: " << recv_bandwidth_bps << ", ";
diff --git a/call/flexfec_receive_stream_impl.cc b/call/flexfec_receive_stream_impl.cc
index 038c1f6..973df66 100644
--- a/call/flexfec_receive_stream_impl.cc
+++ b/call/flexfec_receive_stream_impl.cc
@@ -21,19 +21,22 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/location.h"
 #include "rtc_base/logging.h"
+#include "rtc_base/strings/string_builder.h"
 #include "system_wrappers/include/clock.h"
 
 namespace webrtc {
 
 std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "FlexfecReceiveStream stats: " << time_ms
      << ", {flexfec_bitrate_bps: " << flexfec_bitrate_bps << "}";
   return ss.str();
 }
 
 std::string FlexfecReceiveStream::Config::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{payload_type: " << payload_type;
   ss << ", remote_ssrc: " << remote_ssrc;
   ss << ", local_ssrc: " << local_ssrc;
diff --git a/call/rampup_tests.cc b/call/rampup_tests.cc
index a93dd79..c5920e2 100644
--- a/call/rampup_tests.cc
+++ b/call/rampup_tests.cc
@@ -13,6 +13,7 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/platform_thread.h"
+#include "rtc_base/stringencode.h"
 #include "test/encoder_settings.h"
 #include "test/gtest.h"
 #include "test/testsupport/perf_test.h"
@@ -447,17 +448,13 @@
 std::string RampUpDownUpTester::GetModifierString() const {
   std::string str("_");
   if (num_video_streams_ > 0) {
-    std::ostringstream s;
-    s << num_video_streams_;
-    str += s.str();
+    str += rtc::ToString(num_video_streams_);
     str += "stream";
     str += (num_video_streams_ > 1 ? "s" : "");
     str += "_";
   }
   if (num_audio_streams_ > 0) {
-    std::ostringstream s;
-    s << num_audio_streams_;
-    str += s.str();
+    str += rtc::ToString(num_audio_streams_);
     str += "stream";
     str += (num_audio_streams_ > 1 ? "s" : "");
     str += "_";
diff --git a/call/rtp_config.cc b/call/rtp_config.cc
index 3621f72..71322f9 100644
--- a/call/rtp_config.cc
+++ b/call/rtp_config.cc
@@ -9,20 +9,21 @@
  */
 
 #include "call/rtp_config.h"
-
-#include <sstream>
+#include "rtc_base/strings/string_builder.h"
 
 namespace webrtc {
 
 std::string NackConfig::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{rtp_history_ms: " << rtp_history_ms;
   ss << '}';
   return ss.str();
 }
 
 std::string UlpfecConfig::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{ulpfec_payload_type: " << ulpfec_payload_type;
   ss << ", red_payload_type: " << red_payload_type;
   ss << ", red_rtx_payload_type: " << red_rtx_payload_type;
diff --git a/call/video_config.cc b/call/video_config.cc
index eb32ed5..3010cdf 100644
--- a/call/video_config.cc
+++ b/call/video_config.cc
@@ -10,10 +10,10 @@
 #include "call/video_config.h"
 
 #include <algorithm>
-#include <sstream>
 #include <string>
 
 #include "rtc_base/checks.h"
+#include "rtc_base/strings/string_builder.h"
 
 namespace webrtc {
 VideoStream::VideoStream()
@@ -30,7 +30,8 @@
 VideoStream::~VideoStream() = default;
 
 std::string VideoStream::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{width: " << width;
   ss << ", height: " << height;
   ss << ", max_framerate: " << max_framerate;
@@ -59,7 +60,8 @@
 VideoEncoderConfig::~VideoEncoderConfig() = default;
 
 std::string VideoEncoderConfig::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{codec_type: ";
   ss << CodecTypeToPayloadString(codec_type);
   ss << ", content_type: ";
diff --git a/call/video_receive_stream.cc b/call/video_receive_stream.cc
index f338805..b42c9f9 100644
--- a/call/video_receive_stream.cc
+++ b/call/video_receive_stream.cc
@@ -9,6 +9,7 @@
  */
 
 #include "call/video_receive_stream.h"
+#include "rtc_base/strings/string_builder.h"
 
 namespace webrtc {
 
@@ -17,7 +18,8 @@
 VideoReceiveStream::Decoder::~Decoder() = default;
 
 std::string VideoReceiveStream::Decoder::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{decoder: " << (decoder ? "(VideoDecoder)" : "nullptr");
   ss << ", payload_type: " << payload_type;
   ss << ", payload_name: " << payload_name;
@@ -34,7 +36,8 @@
 VideoReceiveStream::Stats::~Stats() = default;
 
 std::string VideoReceiveStream::Stats::ToString(int64_t time_ms) const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "VideoReceiveStream stats: " << time_ms << ", {ssrc: " << ssrc << ", ";
   ss << "total_bps: " << total_bitrate_bps << ", ";
   ss << "width: " << width << ", ";
@@ -71,7 +74,8 @@
 VideoReceiveStream::Config::Config::~Config() = default;
 
 std::string VideoReceiveStream::Config::ToString() const {
-  std::stringstream ss;
+  char buf[4 * 1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{decoders: [";
   for (size_t i = 0; i < decoders.size(); ++i) {
     ss << decoders[i].ToString();
@@ -97,7 +101,8 @@
 VideoReceiveStream::Config::Rtp::~Rtp() = default;
 
 std::string VideoReceiveStream::Config::Rtp::ToString() const {
-  std::stringstream ss;
+  char buf[2 * 1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{remote_ssrc: " << remote_ssrc;
   ss << ", local_ssrc: " << local_ssrc;
   ss << ", rtcp_mode: "
diff --git a/call/video_send_stream.cc b/call/video_send_stream.cc
index 80f538d..5bf965c 100644
--- a/call/video_send_stream.cc
+++ b/call/video_send_stream.cc
@@ -9,6 +9,7 @@
  */
 
 #include "call/video_send_stream.h"
+#include "rtc_base/strings/string_builder.h"
 
 namespace webrtc {
 
@@ -16,7 +17,8 @@
 VideoSendStream::StreamStats::~StreamStats() = default;
 
 std::string VideoSendStream::StreamStats::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "width: " << width << ", ";
   ss << "height: " << height << ", ";
   ss << "key: " << frame_counts.key_frames << ", ";
@@ -37,7 +39,8 @@
 VideoSendStream::Stats::~Stats() = default;
 
 std::string VideoSendStream::Stats::ToString(int64_t time_ms) const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "VideoSendStream stats: " << time_ms << ", {";
   ss << "input_fps: " << input_frame_rate << ", ";
   ss << "encode_fps: " << encode_frame_rate << ", ";
@@ -68,7 +71,8 @@
 VideoSendStream::Config::Config::~Config() = default;
 
 std::string VideoSendStream::Config::ToString() const {
-  std::stringstream ss;
+  char buf[2 * 1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{encoder_settings: " << encoder_settings.ToString();
   ss << ", rtp: " << rtp.ToString();
   ss << ", rtcp: " << rtcp.ToString();
@@ -85,7 +89,8 @@
 }
 
 std::string VideoSendStream::Config::EncoderSettings::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{payload_name: " << payload_name;
   ss << ", payload_type: " << payload_type;
   ss << ", encoder_factory: "
@@ -104,7 +109,8 @@
 VideoSendStream::Config::Rtp::Flexfec::~Flexfec() = default;
 
 std::string VideoSendStream::Config::Rtp::ToString() const {
-  std::stringstream ss;
+  char buf[2 * 1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{ssrcs: [";
   for (size_t i = 0; i < ssrcs.size(); ++i) {
     ss << ssrcs[i];
@@ -148,7 +154,8 @@
 VideoSendStream::Config::Rtp::Rtx::~Rtx() = default;
 
 std::string VideoSendStream::Config::Rtp::Rtx::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{ssrcs: [";
   for (size_t i = 0; i < ssrcs.size(); ++i) {
     ss << ssrcs[i];
@@ -167,7 +174,8 @@
 VideoSendStream::Config::Rtcp::~Rtcp() = default;
 
 std::string VideoSendStream::Config::Rtcp::ToString() const {
-  std::stringstream ss;
+  char buf[1024];
+  rtc::SimpleStringBuilder ss(buf);
   ss << "{video_report_interval_ms: " << video_report_interval_ms;
   ss << ", audio_report_interval_ms: " << audio_report_interval_ms;
   ss << '}';