Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module_unittest.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 // false. 1119 // false.
1120 bool SetUpSender() { 1120 bool SetUpSender() {
1121 const std::string input_file_name = 1121 const std::string input_file_name =
1122 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"); 1122 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
1123 // Note that |audio_source_| will loop forever. The test duration is set 1123 // Note that |audio_source_| will loop forever. The test duration is set
1124 // explicitly by |kTestDurationMs|. 1124 // explicitly by |kTestDurationMs|.
1125 audio_source_.reset(new test::InputAudioFile(input_file_name)); 1125 audio_source_.reset(new test::InputAudioFile(input_file_name));
1126 static const int kSourceRateHz = 32000; 1126 static const int kSourceRateHz = 32000;
1127 send_test_.reset(new test::AcmSendTestOldApi( 1127 send_test_.reset(new test::AcmSendTestOldApi(
1128 audio_source_.get(), kSourceRateHz, kTestDurationMs)); 1128 audio_source_.get(), kSourceRateHz, kTestDurationMs));
1129 return send_test_.get() != NULL; 1129 return send_test_.get() != nullptr;
1130 } 1130 }
1131 1131
1132 // Registers a send codec in the test::AcmSendTest object. Returns true on 1132 // Registers a send codec in the test::AcmSendTest object. Returns true on
1133 // success, false on failure. 1133 // success, false on failure.
1134 bool RegisterSendCodec(const char* payload_name, 1134 bool RegisterSendCodec(const char* payload_name,
1135 int sampling_freq_hz, 1135 int sampling_freq_hz,
1136 int channels, 1136 int channels,
1137 int payload_type, 1137 int payload_type,
1138 int frame_size_samples, 1138 int frame_size_samples,
1139 int frame_size_rtp_timestamps) { 1139 int frame_size_rtp_timestamps) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 EXPECT_EQ(expected_packets, packet_count_); 1197 EXPECT_EQ(expected_packets, packet_count_);
1198 1198
1199 // Delete the output file. 1199 // Delete the output file.
1200 remove(output_file_name.c_str()); 1200 remove(output_file_name.c_str());
1201 } 1201 }
1202 1202
1203 // Inherited from test::PacketSource. 1203 // Inherited from test::PacketSource.
1204 std::unique_ptr<test::Packet> NextPacket() override { 1204 std::unique_ptr<test::Packet> NextPacket() override {
1205 auto packet = send_test_->NextPacket(); 1205 auto packet = send_test_->NextPacket();
1206 if (!packet) 1206 if (!packet)
1207 return NULL; 1207 return nullptr;
1208 1208
1209 VerifyPacket(packet.get()); 1209 VerifyPacket(packet.get());
1210 // TODO(henrik.lundin) Save the packet to file as well. 1210 // TODO(henrik.lundin) Save the packet to file as well.
1211 1211
1212 // Pass it on to the caller. The caller becomes the owner of |packet|. 1212 // Pass it on to the caller. The caller becomes the owner of |packet|.
1213 return packet; 1213 return packet;
1214 } 1214 }
1215 1215
1216 // Verifies the packet. 1216 // Verifies the packet.
1217 void VerifyPacket(const test::Packet* packet) { 1217 void VerifyPacket(const test::Packet* packet) {
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 remove(output_file_name.c_str()); 1782 remove(output_file_name.c_str());
1783 } 1783 }
1784 1784
1785 // Inherited from test::PacketSource. 1785 // Inherited from test::PacketSource.
1786 std::unique_ptr<test::Packet> NextPacket() override { 1786 std::unique_ptr<test::Packet> NextPacket() override {
1787 // Check if it is time to terminate the test. The packet source is of type 1787 // Check if it is time to terminate the test. The packet source is of type
1788 // ConstantPcmPacketSource, which is infinite, so we must end the test 1788 // ConstantPcmPacketSource, which is infinite, so we must end the test
1789 // "manually". 1789 // "manually".
1790 if (num_packets_++ > kTestNumPackets) { 1790 if (num_packets_++ > kTestNumPackets) {
1791 EXPECT_TRUE(has_toggled_); 1791 EXPECT_TRUE(has_toggled_);
1792 return NULL; // Test ended. 1792 return nullptr; // Test ended.
1793 } 1793 }
1794 1794
1795 // Get the next packet from the source. 1795 // Get the next packet from the source.
1796 return packet_source_.NextPacket(); 1796 return packet_source_.NextPacket();
1797 } 1797 }
1798 1798
1799 // Inherited from test::AudioSink. 1799 // Inherited from test::AudioSink.
1800 bool WriteArray(const int16_t* audio, size_t num_samples) override { 1800 bool WriteArray(const int16_t* audio, size_t num_samples) override {
1801 // Skip checking the first output frame, since it has a number of zeros 1801 // Skip checking the first output frame, since it has a number of zeros
1802 // due to how NetEq is initialized. 1802 // due to how NetEq is initialized.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 Run(16000, 8000, 1000); 1839 Run(16000, 8000, 1000);
1840 } 1840 }
1841 1841
1842 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { 1842 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) {
1843 Run(8000, 16000, 1000); 1843 Run(8000, 16000, 1000);
1844 } 1844 }
1845 1845
1846 #endif 1846 #endif
1847 1847
1848 } // namespace webrtc 1848 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698