Remove simple stringstream usages.
This CL replaces std::o?stringstream with rtc::StringBuilder where that's possible to do without changing any of the surrounding code. It also updates includes and build files as appropriate. The CL was generated by running 'git grep -l -P std::o?stringstream | xargs perl -pi -e "s/std::o?stringstream/rtc::StringBuilder/g"'. Then I've manually updated the #includes and BUILD files, run 'git cl format' and unstaged any file that would need more complex fixes. Bug: webrtc:8982 Change-Id: Ibc32153f4a3fd177e260b6ad05ce393972549357 Reviewed-on: https://webrtc-review.googlesource.com/98460 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24605}
This commit is contained in:
@ -10,7 +10,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h"
|
||||
@ -18,6 +17,7 @@
|
||||
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -142,7 +142,7 @@ void TestGetSetBandwidthInfo(const int16_t* speech_data,
|
||||
|
||||
int elapsed_time_ms = 0;
|
||||
for (int i = 0; elapsed_time_ms < 10000; ++i) {
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << " i = " << i;
|
||||
SCOPED_TRACE(ss.str());
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
|
||||
#include <math.h> // Access to pow function.
|
||||
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -30,7 +31,7 @@ TEST(BufferLevelFilter, ConvergenceTest) {
|
||||
for (int value = 100; value <= 200; value += 10) {
|
||||
filter.Reset();
|
||||
filter.SetTargetBufferLevel(1); // Makes filter coefficient 251/256.
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "times = " << times << ", value = " << value;
|
||||
SCOPED_TRACE(ss.str()); // Print out the parameter values on failure.
|
||||
for (int i = 0; i < times; ++i) {
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
#include "common_audio/include/audio_util.h"
|
||||
#include "modules/audio_coding/neteq/audio_multi_vector.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -33,7 +34,7 @@ class DtmfToneGeneratorTest : public ::testing::Test {
|
||||
AudioMultiVector signal(channels);
|
||||
|
||||
for (int event = 0; event <= 15; ++event) {
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "Checking event " << event << " at sample rate " << fs_hz;
|
||||
SCOPED_TRACE(ss.str());
|
||||
const int kAttenuation = 0;
|
||||
@ -72,7 +73,7 @@ class DtmfToneGeneratorTest : public ::testing::Test {
|
||||
EXPECT_EQ(kNumSamples, tone_gen_.Generate(kNumSamples, &ref_signal));
|
||||
// Test every 5 steps (to save time).
|
||||
for (int attenuation = 1; attenuation <= 63; attenuation += 5) {
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "Checking event " << event << " at sample rate " << fs_hz;
|
||||
ss << "; attenuation " << attenuation;
|
||||
SCOPED_TRACE(ss.str());
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
|
||||
#include "modules/audio_coding/neteq/tools/neteq_external_decoder_test.h"
|
||||
#include "modules/audio_coding/neteq/tools/rtp_generator.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -122,7 +123,7 @@ class NetEqExternalDecoderUnitTest : public test::NetEqExternalDecoderTest {
|
||||
} while (Lost()); // If lost, immediately read the next packet.
|
||||
}
|
||||
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "Lap number " << k << ".";
|
||||
SCOPED_TRACE(ss.str()); // Print out the parameter values on failure.
|
||||
// Compare mono and multi-channel.
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include "modules/audio_coding/neteq/include/neteq.h"
|
||||
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
|
||||
#include "modules/audio_coding/neteq/tools/rtp_generator.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -228,7 +229,7 @@ class NetEqStereoTest : public ::testing::TestWithParam<TestParameters> {
|
||||
EXPECT_EQ(num_channels_, output_multi_channel_.num_channels_);
|
||||
EXPECT_EQ(output_size_samples_,
|
||||
output_multi_channel_.samples_per_channel_);
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "Lap number " << k << ".";
|
||||
SCOPED_TRACE(ss.str()); // Print out the parameter values on failure.
|
||||
// Compare mono and multi-channel.
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "rtc_base/numerics/safe_conversions.h"
|
||||
#include "rtc_base/protobuf_utils.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/system/arch.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gtest.h"
|
||||
@ -386,7 +387,7 @@ void NetEqDecodingTest::DecodeAndCompare(
|
||||
uint64_t last_concealed_samples = 0;
|
||||
uint64_t last_total_samples_received = 0;
|
||||
while (packet_) {
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "Lap number " << i++ << " in DecodeAndCompare while loop";
|
||||
SCOPED_TRACE(ss.str()); // Print out the parameter values on failure.
|
||||
ASSERT_NO_FATAL_FAILURE(Process());
|
||||
@ -900,7 +901,7 @@ TEST_F(NetEqDecodingTest, MAYBE_DecoderError) {
|
||||
static const int kExpectedOutputLength = 160; // 10 ms at 16 kHz sample rate.
|
||||
const int16_t* const_out_frame_data = out_frame_.data();
|
||||
for (int i = 0; i < kExpectedOutputLength; ++i) {
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "i = " << i;
|
||||
SCOPED_TRACE(ss.str()); // Print out the parameter values on failure.
|
||||
EXPECT_EQ(0, const_out_frame_data[i]);
|
||||
@ -922,7 +923,7 @@ TEST_F(NetEqDecodingTest, GetAudioBeforeInsertPacket) {
|
||||
kInitSampleRateHz / 100; // 10 ms at initial sample rate.
|
||||
const int16_t* const_out_frame_data = out_frame_.data();
|
||||
for (int i = 0; i < kExpectedOutputLength; ++i) {
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "i = " << i;
|
||||
SCOPED_TRACE(ss.str()); // Print out the parameter values on failure.
|
||||
EXPECT_EQ(0, const_out_frame_data[i]);
|
||||
@ -1532,7 +1533,7 @@ TEST_F(NetEqDecodingTestTwoInstances, CompareMutedStateOnOff) {
|
||||
AudioFrame out_frame1, out_frame2;
|
||||
bool muted;
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "i = " << i;
|
||||
SCOPED_TRACE(ss.str()); // Print out the loop iterator on failure.
|
||||
EXPECT_EQ(0, neteq_->GetAudio(&out_frame1, &muted));
|
||||
@ -1555,7 +1556,7 @@ TEST_F(NetEqDecodingTestTwoInstances, CompareMutedStateOnOff) {
|
||||
int counter = 0;
|
||||
while (out_frame1.speech_type_ != AudioFrame::kNormalSpeech) {
|
||||
ASSERT_LT(counter++, 1000) << "Test timed out";
|
||||
std::ostringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "counter = " << counter;
|
||||
SCOPED_TRACE(ss.str()); // Print out the loop iterator on failure.
|
||||
EXPECT_EQ(0, neteq_->GetAudio(&out_frame1, &muted));
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#include "modules/audio_coding/neteq/tools/neteq_input.h"
|
||||
|
||||
#include <sstream>
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
@ -19,7 +19,7 @@ NetEqInput::PacketData::PacketData() = default;
|
||||
NetEqInput::PacketData::~PacketData() = default;
|
||||
|
||||
std::string NetEqInput::PacketData::ToString() const {
|
||||
std::stringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << "{"
|
||||
<< "time_ms: " << static_cast<int64_t>(time_ms) << ", "
|
||||
<< "header: {"
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory>
|
||||
#include <sstream> // no-presubmit-check TODO(webrtc:8982)
|
||||
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
@ -21,6 +20,7 @@
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module.h"
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -133,7 +133,7 @@ void Receiver::Setup(AudioCodingModule *acm, RTPStream *rtpStream,
|
||||
|
||||
int playSampFreq;
|
||||
std::string file_name;
|
||||
std::stringstream file_stream;
|
||||
rtc::StringBuilder file_stream;
|
||||
file_stream << webrtc::test::OutputPath() << out_file_name
|
||||
<< static_cast<int>(codeId) << ".pcm";
|
||||
file_name = file_stream.str();
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <memory>
|
||||
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -34,7 +35,7 @@ void ReceiverWithPacketLoss::Setup(AudioCodingModule* acm,
|
||||
loss_rate_ = loss_rate;
|
||||
burst_length_ = burst_length;
|
||||
burst_lost_counter_ = burst_length_; // To prevent first packet gets lost.
|
||||
std::stringstream ss;
|
||||
rtc::StringBuilder ss;
|
||||
ss << out_file_name << "_" << loss_rate_ << "_" << burst_length_ << "_";
|
||||
Receiver::Setup(acm, rtpStream, ss.str(), channels);
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -476,7 +477,7 @@ void TestAllCodecs::Run(TestPack* channel) {
|
||||
|
||||
void TestAllCodecs::OpenOutFile(int test_number) {
|
||||
std::string filename = webrtc::test::OutputPath();
|
||||
std::ostringstream test_number_str;
|
||||
rtc::StringBuilder test_number_str;
|
||||
test_number_str << test_number;
|
||||
filename += "testallcodecs_out_";
|
||||
filename += test_number_str.str();
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -327,7 +328,7 @@ void TestRedFec::Run() {
|
||||
|
||||
void TestRedFec::OpenOutFile(int16_t test_number) {
|
||||
std::string file_name;
|
||||
std::stringstream file_stream;
|
||||
rtc::StringBuilder file_stream;
|
||||
file_stream << webrtc::test::OutputPath();
|
||||
file_stream << "TestRedFec_outFile_";
|
||||
file_stream << test_number << ".pcm";
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -832,7 +833,7 @@ void TestStereo::Run(TestPackStereo* channel,
|
||||
|
||||
void TestStereo::OpenOutFile(int16_t test_number) {
|
||||
std::string file_name;
|
||||
std::stringstream file_stream;
|
||||
rtc::StringBuilder file_stream;
|
||||
file_stream << webrtc::test::OutputPath() << "teststereo_out_" << test_number
|
||||
<< ".pcm";
|
||||
file_name = file_stream.str();
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/audio_coding/test/PCMFile.h"
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -204,7 +205,7 @@ void TestWebRtcVadDtx::Test(bool new_outfile) {
|
||||
if (new_outfile) {
|
||||
output_file_num_++;
|
||||
}
|
||||
std::stringstream out_filename;
|
||||
rtc::StringBuilder out_filename;
|
||||
out_filename << webrtc::test::OutputPath() << "testWebRtcVadDtx_outFile_"
|
||||
<< output_file_num_ << ".pcm";
|
||||
Run(webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"), 32000, 1,
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "modules/audio_coding/test/PCMFile.h"
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
#include "rtc_base/flags.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "system_wrappers/include/event_wrapper.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
@ -171,7 +172,7 @@ class DelayTest {
|
||||
}
|
||||
|
||||
void OpenOutFile(const char* output_id) {
|
||||
std::stringstream file_stream;
|
||||
rtc::StringBuilder file_stream;
|
||||
file_stream << "delay_test_" << FLAG_codec << "_" << FLAG_sample_rate_hz
|
||||
<< "Hz"
|
||||
<< "_" << FLAG_delay << "ms.pcm";
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "modules/audio_coding/codecs/audio_format_conversion.h"
|
||||
#include "modules/audio_coding/test/utility.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "system_wrappers/include/event_wrapper.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -221,8 +222,8 @@ void ISACTest::EncodeDecode(int testNr,
|
||||
_inFileB.Open(file_name_swb_, 32000, "rb", true);
|
||||
|
||||
std::string file_name_out;
|
||||
std::stringstream file_stream_a;
|
||||
std::stringstream file_stream_b;
|
||||
rtc::StringBuilder file_stream_a;
|
||||
rtc::StringBuilder file_stream_b;
|
||||
file_stream_a << webrtc::test::OutputPath();
|
||||
file_stream_b << webrtc::test::OutputPath();
|
||||
file_stream_a << "out_iSACTest_A_" << testNr << ".pcm";
|
||||
@ -288,8 +289,8 @@ void ISACTest::SwitchingSamplingRate(int testNr, int maxSampRateChange) {
|
||||
_inFileB.Open(file_name_swb_, 32000, "rb");
|
||||
|
||||
std::string file_name_out;
|
||||
std::stringstream file_stream_a;
|
||||
std::stringstream file_stream_b;
|
||||
rtc::StringBuilder file_stream_a;
|
||||
rtc::StringBuilder file_stream_b;
|
||||
file_stream_a << webrtc::test::OutputPath();
|
||||
file_stream_b << webrtc::test::OutputPath();
|
||||
file_stream_a << "out_iSACTest_A_" << testNr << ".pcm";
|
||||
|
||||
Reference in New Issue
Block a user