| Index: webrtc/modules/audio_processing/audio_processing_unittest.cc
|
| diff --git a/webrtc/modules/audio_processing/audio_processing_unittest.cc b/webrtc/modules/audio_processing/audio_processing_unittest.cc
|
| index c5f01f96fbeb8b0645cce17beabb456cdcc2250e..981d03f96e9a9e165cea5a1014f9cad5abd1972d 100644
|
| --- a/webrtc/modules/audio_processing/audio_processing_unittest.cc
|
| +++ b/webrtc/modules/audio_processing/audio_processing_unittest.cc
|
| @@ -232,7 +232,7 @@ void WriteStatsMessage(const AudioProcessing::Statistic& output,
|
| void OpenFileAndWriteMessage(const std::string filename,
|
| const ::google::protobuf::MessageLite& msg) {
|
| FILE* file = fopen(filename.c_str(), "wb");
|
| - ASSERT_TRUE(file != NULL);
|
| + ASSERT_TRUE(file != nullptr);
|
|
|
| int32_t size = msg.ByteSize();
|
| ASSERT_GT(size, 0);
|
| @@ -302,7 +302,7 @@ void ClearTempFiles() {
|
| void OpenFileAndReadMessage(std::string filename,
|
| ::google::protobuf::MessageLite* msg) {
|
| FILE* file = fopen(filename.c_str(), "rb");
|
| - ASSERT_TRUE(file != NULL);
|
| + ASSERT_TRUE(file != nullptr);
|
| ReadMessageFromFile(file, msg);
|
| fclose(file);
|
| }
|
| @@ -410,33 +410,33 @@ class ApmTest : public ::testing::Test {
|
| ApmTest::ApmTest()
|
| : output_path_(test::OutputPath()),
|
| #if defined(WEBRTC_AUDIOPROC_FIXED_PROFILE)
|
| - ref_filename_(test::ResourcePath("audio_processing/output_data_fixed",
|
| - "pb")),
|
| + ref_filename_(
|
| + test::ResourcePath("audio_processing/output_data_fixed", "pb")),
|
| #elif defined(WEBRTC_AUDIOPROC_FLOAT_PROFILE)
|
| #if defined(WEBRTC_MAC)
|
| // A different file for Mac is needed because on this platform the AEC
|
| // constant |kFixedDelayMs| value is 20 and not 50 as it is on the rest.
|
| - ref_filename_(test::ResourcePath("audio_processing/output_data_mac",
|
| - "pb")),
|
| + ref_filename_(
|
| + test::ResourcePath("audio_processing/output_data_mac", "pb")),
|
| #else
|
| - ref_filename_(test::ResourcePath("audio_processing/output_data_float",
|
| - "pb")),
|
| + ref_filename_(
|
| + test::ResourcePath("audio_processing/output_data_float", "pb")),
|
| #endif
|
| #endif
|
| - frame_(NULL),
|
| - revframe_(NULL),
|
| + frame_(nullptr),
|
| + revframe_(nullptr),
|
| output_sample_rate_hz_(0),
|
| num_output_channels_(0),
|
| - far_file_(NULL),
|
| - near_file_(NULL),
|
| - out_file_(NULL) {
|
| + far_file_(nullptr),
|
| + near_file_(nullptr),
|
| + out_file_(nullptr) {
|
| Config config;
|
| config.Set<ExperimentalAgc>(new ExperimentalAgc(false));
|
| apm_.reset(AudioProcessing::Create(config));
|
| }
|
|
|
| void ApmTest::SetUp() {
|
| - ASSERT_TRUE(apm_.get() != NULL);
|
| + ASSERT_TRUE(apm_.get() != nullptr);
|
|
|
| frame_ = new AudioFrame();
|
| revframe_ = new AudioFrame();
|
| @@ -448,27 +448,27 @@ void ApmTest::TearDown() {
|
| if (frame_) {
|
| delete frame_;
|
| }
|
| - frame_ = NULL;
|
| + frame_ = nullptr;
|
|
|
| if (revframe_) {
|
| delete revframe_;
|
| }
|
| - revframe_ = NULL;
|
| + revframe_ = nullptr;
|
|
|
| if (far_file_) {
|
| ASSERT_EQ(0, fclose(far_file_));
|
| }
|
| - far_file_ = NULL;
|
| + far_file_ = nullptr;
|
|
|
| if (near_file_) {
|
| ASSERT_EQ(0, fclose(near_file_));
|
| }
|
| - near_file_ = NULL;
|
| + near_file_ = nullptr;
|
|
|
| if (out_file_) {
|
| ASSERT_EQ(0, fclose(out_file_));
|
| }
|
| - out_file_ = NULL;
|
| + out_file_ = nullptr;
|
| }
|
|
|
| void ApmTest::Init(AudioProcessing* ap) {
|
| @@ -500,16 +500,16 @@ void ApmTest::Init(int sample_rate_hz,
|
| }
|
| std::string filename = ResourceFilePath("far", sample_rate_hz);
|
| far_file_ = fopen(filename.c_str(), "rb");
|
| - ASSERT_TRUE(far_file_ != NULL) << "Could not open file " <<
|
| - filename << "\n";
|
| + ASSERT_TRUE(far_file_ != nullptr) << "Could not open file " << filename
|
| + << "\n";
|
|
|
| if (near_file_) {
|
| ASSERT_EQ(0, fclose(near_file_));
|
| }
|
| filename = ResourceFilePath("near", sample_rate_hz);
|
| near_file_ = fopen(filename.c_str(), "rb");
|
| - ASSERT_TRUE(near_file_ != NULL) << "Could not open file " <<
|
| - filename << "\n";
|
| + ASSERT_TRUE(near_file_ != nullptr) << "Could not open file " << filename
|
| + << "\n";
|
|
|
| if (open_output_file) {
|
| if (out_file_) {
|
| @@ -520,8 +520,8 @@ void ApmTest::Init(int sample_rate_hz,
|
| reverse_sample_rate_hz, num_input_channels, num_output_channels,
|
| num_reverse_channels, num_reverse_channels, kForward);
|
| out_file_ = fopen(filename.c_str(), "wb");
|
| - ASSERT_TRUE(out_file_ != NULL) << "Could not open file " <<
|
| - filename << "\n";
|
| + ASSERT_TRUE(out_file_ != nullptr) << "Could not open file " << filename
|
| + << "\n";
|
| }
|
| }
|
|
|
| @@ -555,7 +555,7 @@ bool ApmTest::ReadFrame(FILE* file, AudioFrame* frame,
|
| }
|
|
|
| bool ApmTest::ReadFrame(FILE* file, AudioFrame* frame) {
|
| - return ReadFrame(file, frame, NULL);
|
| + return ReadFrame(file, frame, nullptr);
|
| }
|
|
|
| // If the end of the file has been reached, rewind it and attempt to read the
|
| @@ -569,7 +569,7 @@ void ApmTest::ReadFrameWithRewind(FILE* file, AudioFrame* frame,
|
| }
|
|
|
| void ApmTest::ReadFrameWithRewind(FILE* file, AudioFrame* frame) {
|
| - ReadFrameWithRewind(file, frame, NULL);
|
| + ReadFrameWithRewind(file, frame, nullptr);
|
| }
|
|
|
| void ApmTest::ProcessWithDefaultStreamParameters(AudioFrame* frame) {
|
| @@ -961,10 +961,10 @@ TEST_F(ApmTest, EchoCancellation) {
|
|
|
| EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(true));
|
| EXPECT_TRUE(apm_->echo_cancellation()->is_enabled());
|
| - EXPECT_TRUE(apm_->echo_cancellation()->aec_core() != NULL);
|
| + EXPECT_TRUE(apm_->echo_cancellation()->aec_core() != nullptr);
|
| EXPECT_EQ(apm_->kNoError, apm_->echo_cancellation()->Enable(false));
|
| EXPECT_FALSE(apm_->echo_cancellation()->is_enabled());
|
| - EXPECT_FALSE(apm_->echo_cancellation()->aec_core() != NULL);
|
| + EXPECT_FALSE(apm_->echo_cancellation()->aec_core() != nullptr);
|
| }
|
|
|
| TEST_F(ApmTest, DISABLED_EchoCancellationReportsCorrectDelays) {
|
| @@ -1078,9 +1078,9 @@ TEST_F(ApmTest, EchoControlMobile) {
|
| std::unique_ptr<char[]> echo_path_in(new char[echo_path_size]);
|
| std::unique_ptr<char[]> echo_path_out(new char[echo_path_size]);
|
| EXPECT_EQ(apm_->kNullPointerError,
|
| - apm_->echo_control_mobile()->SetEchoPath(NULL, echo_path_size));
|
| + apm_->echo_control_mobile()->SetEchoPath(nullptr, echo_path_size));
|
| EXPECT_EQ(apm_->kNullPointerError,
|
| - apm_->echo_control_mobile()->GetEchoPath(NULL, echo_path_size));
|
| + apm_->echo_control_mobile()->GetEchoPath(nullptr, echo_path_size));
|
| EXPECT_EQ(apm_->kBadParameterError,
|
| apm_->echo_control_mobile()->GetEchoPath(echo_path_out.get(), 1));
|
| EXPECT_EQ(apm_->kNoError,
|
| @@ -1312,7 +1312,8 @@ TEST_F(ApmTest, AgcOnlyAdaptsWhenTargetSignalIsPresent) {
|
| std::unique_ptr<float[]> float_data(new float[max_length]);
|
| std::string filename = ResourceFilePath("far", kSampleRateHz);
|
| FILE* far_file = fopen(filename.c_str(), "rb");
|
| - ASSERT_TRUE(far_file != NULL) << "Could not open file " << filename << "\n";
|
| + ASSERT_TRUE(far_file != nullptr) << "Could not open file " << filename
|
| + << "\n";
|
| const int kDefaultVolume = apm->gain_control()->stream_analog_level();
|
| const int kDefaultCompressionGain =
|
| apm->gain_control()->compression_gain_db();
|
| @@ -1707,7 +1708,7 @@ void ApmTest::ProcessDebugDump(const std::string& in_filename,
|
| Format format,
|
| int max_size_bytes) {
|
| FILE* in_file = fopen(in_filename.c_str(), "rb");
|
| - ASSERT_TRUE(in_file != NULL);
|
| + ASSERT_TRUE(in_file != nullptr);
|
| audioproc::Event event_msg;
|
| bool first_init = true;
|
|
|
| @@ -1822,9 +1823,9 @@ void ApmTest::VerifyDebugDumpTest(Format format) {
|
| FILE* ref_file = fopen(ref_filename.c_str(), "rb");
|
| FILE* out_file = fopen(out_filename.c_str(), "rb");
|
| FILE* limited_file = fopen(limited_filename.c_str(), "rb");
|
| - ASSERT_TRUE(ref_file != NULL);
|
| - ASSERT_TRUE(out_file != NULL);
|
| - ASSERT_TRUE(limited_file != NULL);
|
| + ASSERT_TRUE(ref_file != nullptr);
|
| + ASSERT_TRUE(out_file != nullptr);
|
| + ASSERT_TRUE(limited_file != nullptr);
|
| std::unique_ptr<uint8_t[]> ref_bytes;
|
| std::unique_ptr<uint8_t[]> out_bytes;
|
| std::unique_ptr<uint8_t[]> limited_bytes;
|
| @@ -1873,7 +1874,7 @@ TEST_F(ApmTest, DebugDump) {
|
| const std::string filename =
|
| test::TempFilename(test::OutputPath(), "debug_aec");
|
| EXPECT_EQ(apm_->kNullPointerError,
|
| - apm_->StartDebugRecording(static_cast<const char*>(NULL), -1));
|
| + apm_->StartDebugRecording(static_cast<const char*>(nullptr), -1));
|
|
|
| #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
|
| // Stopping without having started should be OK.
|
| @@ -1886,7 +1887,7 @@ TEST_F(ApmTest, DebugDump) {
|
|
|
| // Verify the file has been written.
|
| FILE* fid = fopen(filename.c_str(), "r");
|
| - ASSERT_TRUE(fid != NULL);
|
| + ASSERT_TRUE(fid != nullptr);
|
|
|
| // Clean it up.
|
| ASSERT_EQ(0, fclose(fid));
|
| @@ -1897,13 +1898,13 @@ TEST_F(ApmTest, DebugDump) {
|
| EXPECT_EQ(apm_->kUnsupportedFunctionError, apm_->StopDebugRecording());
|
|
|
| // Verify the file has NOT been written.
|
| - ASSERT_TRUE(fopen(filename.c_str(), "r") == NULL);
|
| + ASSERT_TRUE(fopen(filename.c_str(), "r") == nullptr);
|
| #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
|
| }
|
|
|
| // TODO(andrew): expand test to verify output.
|
| TEST_F(ApmTest, DebugDumpFromFileHandle) {
|
| - FILE* fid = NULL;
|
| + FILE* fid = nullptr;
|
| EXPECT_EQ(apm_->kNullPointerError, apm_->StartDebugRecording(fid, -1));
|
| const std::string filename =
|
| test::TempFilename(test::OutputPath(), "debug_aec");
|
| @@ -1921,7 +1922,7 @@ TEST_F(ApmTest, DebugDumpFromFileHandle) {
|
|
|
| // Verify the file has been written.
|
| fid = fopen(filename.c_str(), "r");
|
| - ASSERT_TRUE(fid != NULL);
|
| + ASSERT_TRUE(fid != nullptr);
|
|
|
| // Clean it up.
|
| ASSERT_EQ(0, fclose(fid));
|
| @@ -2460,10 +2461,10 @@ class AudioProcessingTest
|
| num_reverse_input_channels,
|
| num_reverse_output_channels, kReverse).c_str(),
|
| "wb");
|
| - ASSERT_TRUE(far_file != NULL);
|
| - ASSERT_TRUE(near_file != NULL);
|
| - ASSERT_TRUE(out_file != NULL);
|
| - ASSERT_TRUE(rev_out_file != NULL);
|
| + ASSERT_TRUE(far_file != nullptr);
|
| + ASSERT_TRUE(near_file != nullptr);
|
| + ASSERT_TRUE(out_file != nullptr);
|
| + ASSERT_TRUE(rev_out_file != nullptr);
|
|
|
| ChannelBuffer<float> fwd_cb(SamplesFromRate(input_rate),
|
| num_input_channels);
|
| @@ -2600,8 +2601,8 @@ TEST_P(AudioProcessingTest, Formats) {
|
| cf[i].num_reverse_output, cf[i].num_reverse_output,
|
| file_direction).c_str(),
|
| "rb");
|
| - ASSERT_TRUE(out_file != NULL);
|
| - ASSERT_TRUE(ref_file != NULL);
|
| + ASSERT_TRUE(out_file != nullptr);
|
| + ASSERT_TRUE(ref_file != nullptr);
|
|
|
| const size_t ref_length = SamplesFromRate(ref_rate) * out_num;
|
| const size_t out_length = SamplesFromRate(out_rate) * out_num;
|
|
|