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

Side by Side Diff: webrtc/modules/audio_coding/neteq/test/neteq_isac_quality_test.cc

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 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 25 matching lines...) Expand all
36 static const bool bit_rate_dummy = 36 static const bool bit_rate_dummy =
37 RegisterFlagValidator(&FLAGS_bit_rate_kbps, &ValidateBitRate); 37 RegisterFlagValidator(&FLAGS_bit_rate_kbps, &ValidateBitRate);
38 38
39 } // namespace 39 } // namespace
40 40
41 class NetEqIsacQualityTest : public NetEqQualityTest { 41 class NetEqIsacQualityTest : public NetEqQualityTest {
42 protected: 42 protected:
43 NetEqIsacQualityTest(); 43 NetEqIsacQualityTest();
44 void SetUp() override; 44 void SetUp() override;
45 void TearDown() override; 45 void TearDown() override;
46 virtual int EncodeBlock(int16_t* in_data, int block_size_samples, 46 virtual int EncodeBlock(int16_t* in_data, size_t block_size_samples,
47 uint8_t* payload, int max_bytes); 47 uint8_t* payload, size_t max_bytes);
48 private: 48 private:
49 ISACFIX_MainStruct* isac_encoder_; 49 ISACFIX_MainStruct* isac_encoder_;
50 int bit_rate_kbps_; 50 int bit_rate_kbps_;
51 }; 51 };
52 52
53 NetEqIsacQualityTest::NetEqIsacQualityTest() 53 NetEqIsacQualityTest::NetEqIsacQualityTest()
54 : NetEqQualityTest(kIsacBlockDurationMs, 54 : NetEqQualityTest(kIsacBlockDurationMs,
55 kIsacInputSamplingKhz, 55 kIsacInputSamplingKhz,
56 kIsacOutputSamplingKhz, 56 kIsacOutputSamplingKhz,
57 kDecoderISAC), 57 kDecoderISAC),
(...skipping 13 matching lines...) Expand all
71 NetEqQualityTest::SetUp(); 71 NetEqQualityTest::SetUp();
72 } 72 }
73 73
74 void NetEqIsacQualityTest::TearDown() { 74 void NetEqIsacQualityTest::TearDown() {
75 // Free memory. 75 // Free memory.
76 EXPECT_EQ(0, WebRtcIsacfix_Free(isac_encoder_)); 76 EXPECT_EQ(0, WebRtcIsacfix_Free(isac_encoder_));
77 NetEqQualityTest::TearDown(); 77 NetEqQualityTest::TearDown();
78 } 78 }
79 79
80 int NetEqIsacQualityTest::EncodeBlock(int16_t* in_data, 80 int NetEqIsacQualityTest::EncodeBlock(int16_t* in_data,
81 int block_size_samples, 81 size_t block_size_samples,
82 uint8_t* payload, int max_bytes) { 82 uint8_t* payload, size_t max_bytes) {
83 // ISAC takes 10 ms for every call. 83 // ISAC takes 10 ms for every call.
84 const int subblocks = kIsacBlockDurationMs / 10; 84 const int subblocks = kIsacBlockDurationMs / 10;
85 const int subblock_length = 10 * kIsacInputSamplingKhz; 85 const int subblock_length = 10 * kIsacInputSamplingKhz;
86 int value = 0; 86 int value = 0;
87 87
88 int pointer = 0; 88 int pointer = 0;
89 for (int idx = 0; idx < subblocks; idx++, pointer += subblock_length) { 89 for (int idx = 0; idx < subblocks; idx++, pointer += subblock_length) {
90 // The Isac encoder does not perform encoding (and returns 0) until it 90 // The Isac encoder does not perform encoding (and returns 0) until it
91 // receives a sequence of sub-blocks that amount to the frame duration. 91 // receives a sequence of sub-blocks that amount to the frame duration.
92 EXPECT_EQ(0, value); 92 EXPECT_EQ(0, value);
93 value = WebRtcIsacfix_Encode(isac_encoder_, &in_data[pointer], payload); 93 value = WebRtcIsacfix_Encode(isac_encoder_, &in_data[pointer], payload);
94 } 94 }
95 EXPECT_GT(value, 0); 95 EXPECT_GT(value, 0);
96 return value; 96 return value;
97 } 97 }
98 98
99 TEST_F(NetEqIsacQualityTest, Test) { 99 TEST_F(NetEqIsacQualityTest, Test) {
100 Simulate(); 100 Simulate();
101 } 101 }
102 102
103 } // namespace test 103 } // namespace test
104 } // namespace webrtc 104 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698