diff --git a/api/candidate.cc b/api/candidate.cc index 128c470e2f..c2c6c53017 100644 --- a/api/candidate.cc +++ b/api/candidate.cc @@ -78,7 +78,7 @@ std::string Candidate::ToStringInternal(bool sensitive) const { << ":" << related_address_.ToString() << ":" << username_ << ":" << password_ << ":" << network_id_ << ":" << network_cost_ << ":" << generation_ << "]"; - return ost.str(); + return ost.Release(); } uint32_t Candidate::GetPriority(uint32_t type_preference, diff --git a/api/test/videocodec_test_stats.cc b/api/test/videocodec_test_stats.cc index 78c39d0a54..8a935f3d96 100644 --- a/api/test/videocodec_test_stats.cc +++ b/api/test/videocodec_test_stats.cc @@ -36,7 +36,7 @@ std::string VideoCodecTestStats::FrameStatistics::ToString() const { ss << " decode_time_us " << decode_time_us; ss << " rtp_timestamp " << rtp_timestamp; ss << " target_bitrate_kbps " << target_bitrate_kbps; - return ss.str(); + return ss.Release(); } VideoCodecTestStats::VideoStatistics::VideoStatistics() = default; @@ -83,7 +83,7 @@ std::string VideoCodecTestStats::VideoStatistics::ToString( ss << "\n" << prefix << "num_key_frames: " << num_key_frames; ss << "\n" << prefix << "num_spatial_resizes: " << num_spatial_resizes; ss << "\n" << prefix << "max_nalu_size_bytes: " << max_nalu_size_bytes; - return ss.str(); + return ss.Release(); } VideoCodecTestStats::FrameStatistics::FrameStatistics(size_t frame_number, diff --git a/media/base/mediachannel.h b/media/base/mediachannel.h index c1cc156d27..c7d8580dbc 100644 --- a/media/base/mediachannel.h +++ b/media/base/mediachannel.h @@ -88,7 +88,7 @@ static std::string VectorToString(const std::vector& vals) { ost << vals[i].ToString(); } ost << "]"; - return ost.str(); + return ost.Release(); } // Options that can be applied to a VideoMediaChannel or a VideoMediaEngine. @@ -120,7 +120,7 @@ struct VideoOptions { screencast_min_bitrate_kbps); ost << ToStringIfSet("is_screencast ", is_screencast); ost << "}"; - return ost.str(); + return ost.Release(); } // Enable denoising? This flag comes from the getUserMedia @@ -157,7 +157,7 @@ struct RtpHeaderExtension { ost << "uri: " << uri; ost << ", id: " << id; ost << "}"; - return ost.str(); + return ost.Release(); } std::string uri; @@ -626,7 +626,7 @@ struct RtpParameters { separator = ", "; } ost << "}"; - return ost.str(); + return ost.Release(); } protected: diff --git a/media/engine/webrtcvideoengine.cc b/media/engine/webrtcvideoengine.cc index 7caf3a4f56..29b0eb9194 100644 --- a/media/engine/webrtcvideoengine.cc +++ b/media/engine/webrtcvideoengine.cc @@ -190,7 +190,7 @@ static std::string CodecVectorToString(const std::vector& codecs) { } } out << "}"; - return out.str(); + return out.Release(); } static bool ValidateCodecFormats(const std::vector& codecs) { @@ -962,7 +962,7 @@ std::string WebRtcVideoChannel::CodecSettingsVectorToString( } } out << "}"; - return out.str(); + return out.Release(); } bool WebRtcVideoChannel::GetSendCodec(VideoCodec* codec) { diff --git a/media/engine/webrtcvoiceengine.cc b/media/engine/webrtcvoiceengine.cc index d6c2967402..b8ccfc672e 100644 --- a/media/engine/webrtcvoiceengine.cc +++ b/media/engine/webrtcvoiceengine.cc @@ -106,7 +106,7 @@ std::string ToString(const AudioCodec& codec) { ss << " }"; } ss << " (" << codec.id << ")"; - return ss.str(); + return ss.Release(); } bool IsCodec(const AudioCodec& codec, const char* ref_name) { diff --git a/modules/audio_coding/neteq/tools/neteq_input.cc b/modules/audio_coding/neteq/tools/neteq_input.cc index ecbd9e054d..645894da6b 100644 --- a/modules/audio_coding/neteq/tools/neteq_input.cc +++ b/modules/audio_coding/neteq/tools/neteq_input.cc @@ -28,7 +28,7 @@ std::string NetEqInput::PacketData::ToString() const { << "ts: " << header.timestamp << ", " << "ssrc: " << header.ssrc << "}, " << "payload bytes: " << payload.size() << "}"; - return ss.str(); + return ss.Release(); } TimeLimitedNetEqInput::TimeLimitedNetEqInput(std::unique_ptr input, diff --git a/modules/audio_mixer/audio_mixer_impl_unittest.cc b/modules/audio_mixer/audio_mixer_impl_unittest.cc index 86a4b66293..29632ca6b4 100644 --- a/modules/audio_mixer/audio_mixer_impl_unittest.cc +++ b/modules/audio_mixer/audio_mixer_impl_unittest.cc @@ -54,7 +54,7 @@ std::string ProduceDebugText(int sample_rate_hz, ss << "Sample rate: " << sample_rate_hz << " "; ss << "Number of channels: " << number_of_channels << " "; ss << "Number of sources: " << number_of_sources; - return ss.str(); + return ss.Release(); } AudioFrame frame_for_mixing; diff --git a/modules/audio_mixer/audio_mixer_test.cc b/modules/audio_mixer/audio_mixer_test.cc index 21b92daa1f..2004aeef46 100644 --- a/modules/audio_mixer/audio_mixer_test.cc +++ b/modules/audio_mixer/audio_mixer_test.cc @@ -78,7 +78,7 @@ class FilePlayingSource : public AudioMixer::Source { rtc::StringBuilder ss; ss << "{rate: " << sample_rate_hz_ << ", channels: " << number_of_channels_ << ", samples_tot: " << wav_reader_->num_samples() << "}"; - return ss.str(); + return ss.Release(); } private: diff --git a/modules/audio_mixer/frame_combiner_unittest.cc b/modules/audio_mixer/frame_combiner_unittest.cc index bf136295df..45d8a4e912 100644 --- a/modules/audio_mixer/frame_combiner_unittest.cc +++ b/modules/audio_mixer/frame_combiner_unittest.cc @@ -38,7 +38,7 @@ std::string ProduceDebugText(int sample_rate_hz, ss << "Sample rate: " << sample_rate_hz << " ,"; ss << "number of channels: " << number_of_channels << " ,"; ss << "number of sources: " << number_of_sources; - return ss.str(); + return ss.Release(); } std::string ProduceDebugText(const FrameCombinerConfig& config) { @@ -47,7 +47,7 @@ std::string ProduceDebugText(const FrameCombinerConfig& config) { ss << "number of channels: " << config.number_of_channels << " ,"; ss << "limiter active: " << (config.use_limiter ? "on" : "off") << " ,"; ss << "wave frequency: " << config.wave_frequency << " ,"; - return ss.str(); + return ss.Release(); } AudioFrame frame1; diff --git a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc index 7169965d53..3d583e861c 100644 --- a/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc +++ b/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc @@ -43,7 +43,7 @@ namespace { std::string ProduceDebugText(size_t delay) { rtc::StringBuilder ss; ss << ", Delay: " << delay; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/block_framer_unittest.cc b/modules/audio_processing/aec3/block_framer_unittest.cc index 3f4122ffc9..9baade98d4 100644 --- a/modules/audio_processing/aec3/block_framer_unittest.cc +++ b/modules/audio_processing/aec3/block_framer_unittest.cc @@ -161,7 +161,7 @@ void RunWronglyInsertOrderTest(int sample_rate_hz, std::string ProduceDebugText(int sample_rate_hz) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/block_processor_unittest.cc b/modules/audio_processing/aec3/block_processor_unittest.cc index fbe1973f4c..71457868b2 100644 --- a/modules/audio_processing/aec3/block_processor_unittest.cc +++ b/modules/audio_processing/aec3/block_processor_unittest.cc @@ -95,7 +95,7 @@ void RunCaptureNumBandsVerificationTest(int sample_rate_hz) { std::string ProduceDebugText(int sample_rate_hz) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/decimator_unittest.cc b/modules/audio_processing/aec3/decimator_unittest.cc index 0c230d0529..08dc428666 100644 --- a/modules/audio_processing/aec3/decimator_unittest.cc +++ b/modules/audio_processing/aec3/decimator_unittest.cc @@ -28,7 +28,7 @@ namespace { std::string ProduceDebugText(int sample_rate_hz) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz; - return ss.str(); + return ss.Release(); } constexpr size_t kDownSamplingFactors[] = {2, 4, 8}; diff --git a/modules/audio_processing/aec3/echo_canceller3_unittest.cc b/modules/audio_processing/aec3/echo_canceller3_unittest.cc index 8cc6d5be55..3f1e059a0c 100644 --- a/modules/audio_processing/aec3/echo_canceller3_unittest.cc +++ b/modules/audio_processing/aec3/echo_canceller3_unittest.cc @@ -606,13 +606,13 @@ class EchoCanceller3Tester { std::string ProduceDebugText(int sample_rate_hz) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz; - return ss.str(); + return ss.Release(); } std::string ProduceDebugText(int sample_rate_hz, int variant) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz << ", variant: " << variant; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc b/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc index 5764d1c43d..311a4a22d5 100644 --- a/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc +++ b/modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc @@ -29,7 +29,7 @@ std::string ProduceDebugText(size_t delay, size_t down_sampling_factor) { rtc::StringBuilder ss; ss << "Delay: " << delay; ss << ", Down sampling factor: " << down_sampling_factor; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/echo_remover_unittest.cc b/modules/audio_processing/aec3/echo_remover_unittest.cc index 9a246ede30..da03f4c8e8 100644 --- a/modules/audio_processing/aec3/echo_remover_unittest.cc +++ b/modules/audio_processing/aec3/echo_remover_unittest.cc @@ -30,13 +30,13 @@ namespace { std::string ProduceDebugText(int sample_rate_hz) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz; - return ss.str(); + return ss.Release(); } std::string ProduceDebugText(int sample_rate_hz, int delay) { rtc::StringBuilder ss(ProduceDebugText(sample_rate_hz)); ss << ", Delay: " << delay; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/frame_blocker_unittest.cc b/modules/audio_processing/aec3/frame_blocker_unittest.cc index 1fb7601e38..3ec74cc093 100644 --- a/modules/audio_processing/aec3/frame_blocker_unittest.cc +++ b/modules/audio_processing/aec3/frame_blocker_unittest.cc @@ -230,7 +230,7 @@ void RunWrongExtractOrderTest(int sample_rate_hz, std::string ProduceDebugText(int sample_rate_hz) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc b/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc index 6dbf69f591..8c44ae064e 100644 --- a/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc +++ b/modules/audio_processing/aec3/main_filter_update_gain_unittest.cc @@ -177,14 +177,14 @@ void RunFilterUpdateTest(int num_blocks_to_process, std::string ProduceDebugText(int filter_length_blocks) { rtc::StringBuilder ss; ss << "Length: " << filter_length_blocks; - return ss.str(); + return ss.Release(); } std::string ProduceDebugText(size_t delay, int filter_length_blocks) { rtc::StringBuilder ss; ss << "Delay: " << delay << ", "; ss << ProduceDebugText(filter_length_blocks); - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/matched_filter_unittest.cc b/modules/audio_processing/aec3/matched_filter_unittest.cc index 4353003a87..16b603a13f 100644 --- a/modules/audio_processing/aec3/matched_filter_unittest.cc +++ b/modules/audio_processing/aec3/matched_filter_unittest.cc @@ -37,7 +37,7 @@ std::string ProduceDebugText(size_t delay, size_t down_sampling_factor) { rtc::StringBuilder ss; ss << "Delay: " << delay; ss << ", Down sampling factor: " << down_sampling_factor; - return ss.str(); + return ss.Release(); } constexpr size_t kNumMatchedFilters = 10; diff --git a/modules/audio_processing/aec3/render_delay_buffer_unittest.cc b/modules/audio_processing/aec3/render_delay_buffer_unittest.cc index 29df28cca6..ee89597261 100644 --- a/modules/audio_processing/aec3/render_delay_buffer_unittest.cc +++ b/modules/audio_processing/aec3/render_delay_buffer_unittest.cc @@ -27,7 +27,7 @@ namespace { std::string ProduceDebugText(int sample_rate_hz) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/render_delay_controller_unittest.cc b/modules/audio_processing/aec3/render_delay_controller_unittest.cc index 4486d1beb5..93c64998e9 100644 --- a/modules/audio_processing/aec3/render_delay_controller_unittest.cc +++ b/modules/audio_processing/aec3/render_delay_controller_unittest.cc @@ -31,13 +31,13 @@ namespace { std::string ProduceDebugText(int sample_rate_hz) { rtc::StringBuilder ss; ss << "Sample rate: " << sample_rate_hz; - return ss.str(); + return ss.Release(); } std::string ProduceDebugText(int sample_rate_hz, size_t delay) { rtc::StringBuilder ss; ss << ProduceDebugText(sample_rate_hz) << ", Delay: " << delay; - return ss.str(); + return ss.Release(); } constexpr size_t kDownSamplingFactors[] = {2, 4, 8}; diff --git a/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc b/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc index d363689ac7..c040bbff91 100644 --- a/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc +++ b/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc @@ -118,14 +118,14 @@ void RunFilterUpdateTest(int num_blocks_to_process, std::string ProduceDebugText(int filter_length_blocks) { rtc::StringBuilder ss; ss << "Length: " << filter_length_blocks; - return ss.str(); + return ss.Release(); } std::string ProduceDebugText(size_t delay, int filter_length_blocks) { rtc::StringBuilder ss; ss << "Delay: " << delay << ", "; ss << ProduceDebugText(filter_length_blocks); - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/aec3/subtractor_unittest.cc b/modules/audio_processing/aec3/subtractor_unittest.cc index b308d38f95..ba744a6a83 100644 --- a/modules/audio_processing/aec3/subtractor_unittest.cc +++ b/modules/audio_processing/aec3/subtractor_unittest.cc @@ -106,7 +106,7 @@ std::string ProduceDebugText(size_t delay, int filter_length_blocks) { rtc::StringBuilder ss; ss << "Delay: " << delay << ", "; ss << "Length: " << filter_length_blocks; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/audio_processing/gain_controller2.cc b/modules/audio_processing/gain_controller2.cc index 6368e92dd7..4d7cc1cd05 100644 --- a/modules/audio_processing/gain_controller2.cc +++ b/modules/audio_processing/gain_controller2.cc @@ -73,7 +73,7 @@ std::string GainController2::ToString( rtc::StringBuilder ss; ss << "{enabled: " << (config.enabled ? "true" : "false") << ", " << "fixed_gain_dB: " << config.fixed_gain_db << "}"; - return ss.str(); + return ss.Release(); } } // namespace webrtc diff --git a/modules/audio_processing/test/audio_processing_simulator.cc b/modules/audio_processing/test/audio_processing_simulator.cc index e8519f24bf..4ac92ee796 100644 --- a/modules/audio_processing/test/audio_processing_simulator.cc +++ b/modules/audio_processing/test/audio_processing_simulator.cc @@ -644,7 +644,7 @@ std::string GetIndexedOutputWavFilename(const std::string& wav_name, rtc::StringBuilder ss; ss << wav_name.substr(0, wav_name.size() - 4) << "_" << counter << wav_name.substr(wav_name.size() - 4); - return ss.str(); + return ss.Release(); } void WriteEchoLikelihoodGraphFileHeader(std::ofstream* output_file) { diff --git a/modules/audio_processing/test/fake_recording_device_unittest.cc b/modules/audio_processing/test/fake_recording_device_unittest.cc index 484972ccc5..a14da827c5 100644 --- a/modules/audio_processing/test/fake_recording_device_unittest.cc +++ b/modules/audio_processing/test/fake_recording_device_unittest.cc @@ -100,13 +100,13 @@ void CheckSameSign(const ChannelBuffer* src, std::string FakeRecordingDeviceKindToString(int fake_rec_device_kind) { rtc::StringBuilder ss; ss << "fake recording device: " << fake_rec_device_kind; - return ss.str(); + return ss.Release(); } std::string AnalogLevelToString(int level) { rtc::StringBuilder ss; ss << "analog level: " << level; - return ss.str(); + return ss.Release(); } } // namespace diff --git a/modules/remote_bitrate_estimator/test/bwe_test_framework.h b/modules/remote_bitrate_estimator/test/bwe_test_framework.h index 6c4a1ec21e..c84a90187c 100644 --- a/modules/remote_bitrate_estimator/test/bwe_test_framework.h +++ b/modules/remote_bitrate_estimator/test/bwe_test_framework.h @@ -131,7 +131,7 @@ class Stats { rtc::StringBuilder ss; ss << (GetMean() >= 0 ? GetMean() : -1) << ", " << (GetStdDev() >= 0 ? GetStdDev() : -1); - return ss.str(); + return ss.Release(); } void Log(const std::string& units) { diff --git a/modules/remote_bitrate_estimator/test/bwe_test_logging.cc b/modules/remote_bitrate_estimator/test/bwe_test_logging.cc index 0778040eb0..cf44fa070a 100644 --- a/modules/remote_bitrate_estimator/test/bwe_test_logging.cc +++ b/modules/remote_bitrate_estimator/test/bwe_test_logging.cc @@ -29,7 +29,7 @@ namespace bwe { static std::string ToString(uint32_t v) { rtc::StringBuilder ss; ss << v; - return ss.str(); + return ss.Release(); } Logging::ThreadState::ThreadState() = default; diff --git a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc index 2251df793c..4dc268a043 100644 --- a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc +++ b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc @@ -279,7 +279,7 @@ std::string VideoCodecTestFixtureImpl::Config::ToString() const { } } ss << "\n"; - return ss.str(); + return ss.Release(); } std::string VideoCodecTestFixtureImpl::Config::CodecName() const { diff --git a/p2p/base/dtlstransport.h b/p2p/base/dtlstransport.h index 5c0f795a08..456f375a10 100644 --- a/p2p/base/dtlstransport.h +++ b/p2p/base/dtlstransport.h @@ -186,7 +186,7 @@ class DtlsTransport : public DtlsTransportInternal { rtc::StringBuilder sb; sb << "DtlsTransport[" << transport_name_ << "|" << component_ << "|" << RECEIVING_ABBREV[receiving()] << WRITABLE_ABBREV[writable()] << "]"; - return sb.str(); + return sb.Release(); } private: diff --git a/p2p/base/p2ptransportchannel.h b/p2p/base/p2ptransportchannel.h index e4d371f2df..fbed344cc3 100644 --- a/p2p/base/p2ptransportchannel.h +++ b/p2p/base/p2ptransportchannel.h @@ -177,7 +177,7 @@ class P2PTransportChannel : public IceTransportInternal { rtc::StringBuilder ss; ss << "Channel[" << transport_name_ << "|" << component_ << "|" << RECEIVING_ABBREV[receiving_] << WRITABLE_ABBREV[writable_] << "]"; - return ss.str(); + return ss.Release(); } private: diff --git a/p2p/base/port.cc b/p2p/base/port.cc index 473f623a29..095b3a6d02 100644 --- a/p2p/base/port.cc +++ b/p2p/base/port.cc @@ -909,7 +909,7 @@ std::string Port::ToString() const { ss << "Port[" << rtc::ToHex(reinterpret_cast(this)) << ":" << content_name_ << ":" << component_ << ":" << generation_ << ":" << type_ << ":" << network_->ToString() << "]"; - return ss.str(); + return ss.Release(); } // TODO(honghaiz): Make the network cost configurable from user setting. @@ -1612,7 +1612,7 @@ std::string Connection::ToString() const { } else { ss << "-]"; } - return ss.str(); + return ss.Release(); } std::string Connection::ToSensitiveString() const { diff --git a/p2p/base/turnport.cc b/p2p/base/turnport.cc index 0883534538..a6d25512b4 100644 --- a/p2p/base/turnport.cc +++ b/p2p/base/turnport.cc @@ -1240,7 +1240,7 @@ std::string TurnPort::ReconstructedServerUrl() { rtc::StringBuilder url; url << scheme << ":" << server_address_.address.ipaddr().ToString() << ":" << server_address_.address.port() << "?transport=" << transport; - return url.str(); + return url.Release(); } void TurnPort::TurnCustomizerMaybeModifyOutgoingStunMessage( diff --git a/p2p/base/turnserver.cc b/p2p/base/turnserver.cc index 160e25965d..022113e7e7 100644 --- a/p2p/base/turnserver.cc +++ b/p2p/base/turnserver.cc @@ -600,7 +600,7 @@ std::string TurnServerConnection::ToString() const { }; rtc::StringBuilder ost; ost << src_.ToString() << "-" << dst_.ToString() << ":"<< kProtos[proto_]; - return ost.str(); + return ost.Release(); } TurnServerAllocation::TurnServerAllocation(TurnServer* server, @@ -633,7 +633,7 @@ TurnServerAllocation::~TurnServerAllocation() { std::string TurnServerAllocation::ToString() const { rtc::StringBuilder ost; ost << "Alloc[" << conn_.ToString() << "]"; - return ost.str(); + return ost.Release(); } void TurnServerAllocation::HandleTurnMessage(const TurnMessage* msg) { diff --git a/pc/mediasession_unittest.cc b/pc/mediasession_unittest.cc index 1a33a7ca9e..db325ed2ef 100644 --- a/pc/mediasession_unittest.cc +++ b/pc/mediasession_unittest.cc @@ -3711,7 +3711,7 @@ void TestAudioCodecsAnswer(RtpTransceiverDirection offer_direction, first = false; } os << " }"; - return os.str(); + return os.Release(); }; EXPECT_TRUE(acd->codecs() == target_codecs) diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc index 029d77939c..7ad2e3d973 100644 --- a/pc/peerconnection.cc +++ b/pc/peerconnection.cc @@ -607,7 +607,7 @@ std::string GetSetDescriptionErrorMessage(cricket::ContentSource source, rtc::StringBuilder oss; oss << "Failed to set " << (source == cricket::CS_LOCAL ? "local" : "remote") << " " << SdpTypeToString(type) << " sdp: " << error.message(); - return oss.str(); + return oss.Release(); } std::string GetStreamIdsString(rtc::ArrayView stream_ids) { @@ -5847,7 +5847,7 @@ std::string PeerConnection::GetSessionErrorMsg() { rtc::StringBuilder desc; desc << kSessionError << SessionErrorToString(session_error()) << ". "; desc << kSessionErrorDesc << session_error_desc() << "."; - return desc.str(); + return desc.Release(); } void PeerConnection::ReportSdpFormatReceived( diff --git a/rtc_base/network.cc b/rtc_base/network.cc index f0d402efe6..67888ede83 100644 --- a/rtc_base/network.cc +++ b/rtc_base/network.cc @@ -184,7 +184,7 @@ std::string MakeNetworkKey(const std::string& name, int prefix_length) { rtc::StringBuilder ost; ost << name << "%" << prefix.ToString() << "/" << prefix_length; - return ost.str(); + return ost.Release(); } // Test if the network name matches the type pattern, e.g. eth0. The // matching is case-sensitive. @@ -1075,7 +1075,7 @@ std::string Network::ToString() const { ss << "/" << AdapterTypeToString(underlying_type_for_vpn_); } ss << ":id=" << id_ << "]"; - return ss.str(); + return ss.Release(); } } // namespace rtc diff --git a/rtc_base/sslidentity.cc b/rtc_base/sslidentity.cc index b9ada0074d..823fc388a3 100644 --- a/rtc_base/sslidentity.cc +++ b/rtc_base/sslidentity.cc @@ -136,7 +136,7 @@ std::string SSLIdentity::DerToPem(const std::string& pem_type, result << "-----END " << pem_type << "-----\n"; - return result.str(); + return result.Release(); } // static diff --git a/rtc_base/strings/string_builder.h b/rtc_base/strings/string_builder.h index d95b29decb..186c2f7b9d 100644 --- a/rtc_base/strings/string_builder.h +++ b/rtc_base/strings/string_builder.h @@ -157,8 +157,8 @@ class StringBuilder { size_t size() const { return str_.size(); } std::string Release() { - std::string ret; - std::swap(str_, ret); + std::string ret = std::move(str_); + str_.clear(); return ret; } diff --git a/rtc_base/timeutils.h b/rtc_base/timeutils.h index c6ea0127d7..3a412a47cf 100644 --- a/rtc_base/timeutils.h +++ b/rtc_base/timeutils.h @@ -145,7 +145,7 @@ class IntervalRange { std::string ToString() const { rtc::StringBuilder ss; ss << "[" << min_ << "," << max_ << "]"; - return ss.str(); + return ss.Release(); } bool operator==(const IntervalRange& o) const { diff --git a/rtc_tools/event_log_visualizer/analyzer.cc b/rtc_tools/event_log_visualizer/analyzer.cc index c51aae3ab5..c9187ca70c 100644 --- a/rtc_tools/event_log_visualizer/analyzer.cc +++ b/rtc_tools/event_log_visualizer/analyzer.cc @@ -78,7 +78,7 @@ void SortPacketFeedbackVector(std::vector* vec) { std::string SsrcToString(uint32_t ssrc) { rtc::StringBuilder ss; ss << "SSRC " << ssrc; - return ss.str(); + return ss.Release(); } // Checks whether an SSRC is contained in the list of desired SSRCs. @@ -424,7 +424,7 @@ std::string GetCandidatePairLogDescriptionAsString( << remote_candidate_type << ":" << GetAddressFamilyAsString(config.remote_address_family) << "@" << GetProtocolAsString(config.candidate_pair_protocol); - return ss.str(); + return ss.Release(); } std::string GetDirectionAsString(PacketDirection direction) { diff --git a/sdk/android/src/jni/androidnetworkmonitor.cc b/sdk/android/src/jni/androidnetworkmonitor.cc index 3dd280b7d7..b1351ef1e1 100644 --- a/sdk/android/src/jni/androidnetworkmonitor.cc +++ b/sdk/android/src/jni/androidnetworkmonitor.cc @@ -164,7 +164,7 @@ std::string NetworkInformation::ToString() const { ss << " " << address.ToString(); } ss << "]"; - return ss.str(); + return ss.Release(); } AndroidNetworkMonitor::AndroidNetworkMonitor( diff --git a/video/end_to_end_tests/stats_tests.cc b/video/end_to_end_tests/stats_tests.cc index 7899eb7de6..db500492a7 100644 --- a/video/end_to_end_tests/stats_tests.cc +++ b/video/end_to_end_tests/stats_tests.cc @@ -218,7 +218,7 @@ TEST_F(StatsEndToEndTest, GetStats) { std::string CompoundKey(const char* name, uint32_t ssrc) { rtc::StringBuilder oss; oss << name << "_" << ssrc; - return oss.str(); + return oss.Release(); } bool AllStatsFilled(const std::map& stats_map) { diff --git a/video/stats_counter.cc b/video/stats_counter.cc index 8f282b0ae9..1e72a79bbd 100644 --- a/video/stats_counter.cc +++ b/video/stats_counter.cc @@ -36,7 +36,7 @@ std::string AggregatedStats::ToStringWithMultiplier(int multiplier) const { ss << "min:" << (min * multiplier) << ", "; ss << "avg:" << (average * multiplier) << ", "; ss << "max:" << (max * multiplier) << "}"; - return ss.str(); + return ss.Release(); } // Class holding periodically computed metrics. diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc index 9596cfa4ba..7f7c8737a1 100644 --- a/video/video_quality_test.cc +++ b/video/video_quality_test.cc @@ -250,7 +250,7 @@ std::string VideoQualityTest::GenerateGraphTitle() const { if (params_.ss[0].num_spatial_layers > 1) ss << ", Layer #" << params_.ss[0].selected_sl; ss << ")"; - return ss.str(); + return ss.Release(); } void VideoQualityTest::CheckParamsAndInjectionComponents() { diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc index 0bcf8ca28b..b7b5a32611 100644 --- a/video/video_stream_encoder.cc +++ b/video/video_stream_encoder.cc @@ -1267,7 +1267,7 @@ std::string VideoStreamEncoder::AdaptCounter::ToString() const { rtc::StringBuilder ss; ss << "Downgrade counts: fps: {" << ToString(fps_counters_); ss << "}, resolution: {" << ToString(resolution_counters_) << "}"; - return ss.str(); + return ss.Release(); } VideoStreamEncoderObserver::AdaptationSteps @@ -1361,7 +1361,7 @@ std::string VideoStreamEncoder::AdaptCounter::ToString( for (size_t reason = 0; reason < kScaleReasonSize; ++reason) { ss << (reason ? " cpu" : "quality") << ":" << counters[reason]; } - return ss.str(); + return ss.Release(); } } // namespace webrtc