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

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

Issue 1228843002: Update audio code to use size_t more correctly, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments Created 5 years, 4 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 void SetUp() override { 53 void SetUp() override {
54 ASSERT_EQ(1, channels_) << "PCMu supports only mono audio."; 54 ASSERT_EQ(1, channels_) << "PCMu supports only mono audio.";
55 AudioEncoderPcmU::Config config; 55 AudioEncoderPcmU::Config config;
56 config.frame_size_ms = FLAGS_frame_size_ms; 56 config.frame_size_ms = FLAGS_frame_size_ms;
57 encoder_.reset(new AudioEncoderPcmU(config)); 57 encoder_.reset(new AudioEncoderPcmU(config));
58 NetEqQualityTest::SetUp(); 58 NetEqQualityTest::SetUp();
59 } 59 }
60 60
61 int EncodeBlock(int16_t* in_data, 61 int EncodeBlock(int16_t* in_data,
62 int block_size_samples, 62 size_t block_size_samples,
63 uint8_t* payload, 63 uint8_t* payload,
64 int max_bytes) override { 64 size_t max_bytes) override {
65 const int kFrameSizeSamples = 80; // Samples per 10 ms. 65 const size_t kFrameSizeSamples = 80; // Samples per 10 ms.
66 int encoded_samples = 0; 66 size_t encoded_samples = 0;
67 uint32_t dummy_timestamp = 0; 67 uint32_t dummy_timestamp = 0;
68 AudioEncoder::EncodedInfo info; 68 AudioEncoder::EncodedInfo info;
69 do { 69 do {
70 info = encoder_->Encode(dummy_timestamp, &in_data[encoded_samples], 70 info = encoder_->Encode(dummy_timestamp, &in_data[encoded_samples],
71 kFrameSizeSamples, max_bytes, payload); 71 kFrameSizeSamples, max_bytes, payload);
72 encoded_samples += kFrameSizeSamples; 72 encoded_samples += kFrameSizeSamples;
73 } while (info.encoded_bytes == 0); 73 } while (info.encoded_bytes == 0);
74 return rtc::checked_cast<int>(info.encoded_bytes); 74 return rtc::checked_cast<int>(info.encoded_bytes);
75 } 75 }
76 76
77 private: 77 private:
78 rtc::scoped_ptr<AudioEncoderPcmU> encoder_; 78 rtc::scoped_ptr<AudioEncoderPcmU> encoder_;
79 }; 79 };
80 80
81 TEST_F(NetEqPcmuQualityTest, Test) { 81 TEST_F(NetEqPcmuQualityTest, Test) {
82 Simulate(); 82 Simulate();
83 } 83 }
84 84
85 } // namespace test 85 } // namespace test
86 } // namespace webrtc 86 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/test/neteq_opus_quality_test.cc ('k') | webrtc/modules/audio_coding/neteq/time_stretch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698