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

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

Issue 1418423010: Pass audio to AudioEncoder::Encode() in an ArrayView (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 1 month 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 int EncodeBlock(int16_t* in_data, 60 int EncodeBlock(int16_t* in_data,
61 size_t block_size_samples, 61 size_t block_size_samples,
62 uint8_t* payload, 62 uint8_t* payload,
63 size_t max_bytes) override { 63 size_t max_bytes) override {
64 const size_t kFrameSizeSamples = 80; // Samples per 10 ms. 64 const size_t kFrameSizeSamples = 80; // Samples per 10 ms.
65 size_t encoded_samples = 0; 65 size_t encoded_samples = 0;
66 uint32_t dummy_timestamp = 0; 66 uint32_t dummy_timestamp = 0;
67 AudioEncoder::EncodedInfo info; 67 AudioEncoder::EncodedInfo info;
68 do { 68 do {
69 info = encoder_->Encode(dummy_timestamp, &in_data[encoded_samples], 69 info = encoder_->Encode(dummy_timestamp,
70 kFrameSizeSamples, max_bytes, payload); 70 rtc::ArrayView<const int16_t>(
71 in_data + encoded_samples, kFrameSizeSamples),
72 max_bytes, payload);
71 encoded_samples += kFrameSizeSamples; 73 encoded_samples += kFrameSizeSamples;
72 } while (info.encoded_bytes == 0); 74 } while (info.encoded_bytes == 0);
73 return rtc::checked_cast<int>(info.encoded_bytes); 75 return rtc::checked_cast<int>(info.encoded_bytes);
74 } 76 }
75 77
76 private: 78 private:
77 rtc::scoped_ptr<AudioEncoderIlbc> encoder_; 79 rtc::scoped_ptr<AudioEncoderIlbc> encoder_;
78 }; 80 };
79 81
80 TEST_F(NetEqIlbcQualityTest, Test) { 82 TEST_F(NetEqIlbcQualityTest, Test) {
81 Simulate(); 83 Simulate();
82 } 84 }
83 85
84 } // namespace test 86 } // namespace test
85 } // namespace webrtc 87 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/test/neteq_pcmu_quality_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698