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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_stereo_unittest.cc

Issue 2750783004: Add mute state field to AudioFrame. (Closed)
Patch Set: Update new usages of AudioFrame::data_ Created 3 years, 6 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 encoded_multi_channel_); 158 encoded_multi_channel_);
159 if (frame_size_samples_ * 2 * num_channels_ != multi_payload_size_bytes_) { 159 if (frame_size_samples_ * 2 * num_channels_ != multi_payload_size_bytes_) {
160 return -1; 160 return -1;
161 } 161 }
162 rtp_generator_.GetRtpHeader(kPayloadTypeMulti, frame_size_samples_, 162 rtp_generator_.GetRtpHeader(kPayloadTypeMulti, frame_size_samples_,
163 &rtp_header_); 163 &rtp_header_);
164 return next_send_time; 164 return next_send_time;
165 } 165 }
166 166
167 virtual void VerifyOutput(size_t num_samples) { 167 virtual void VerifyOutput(size_t num_samples) {
168 const int16_t* output_data = output_.data();
169 const int16_t* output_multi_channel_data = output_multi_channel_.data();
168 for (size_t i = 0; i < num_samples; ++i) { 170 for (size_t i = 0; i < num_samples; ++i) {
169 for (size_t j = 0; j < num_channels_; ++j) { 171 for (size_t j = 0; j < num_channels_; ++j) {
170 ASSERT_EQ(output_.data_[i], 172 ASSERT_EQ(output_data[i],
171 output_multi_channel_.data_[i * num_channels_ + j]) 173 output_multi_channel_data[i * num_channels_ + j])
172 << "Diff in sample " << i << ", channel " << j << "."; 174 << "Diff in sample " << i << ", channel " << j << ".";
173 } 175 }
174 } 176 }
175 } 177 }
176 178
177 virtual int GetArrivalTime(int send_time) { 179 virtual int GetArrivalTime(int send_time) {
178 int arrival_time = last_arrival_time_ + (send_time - last_send_time_); 180 int arrival_time = last_arrival_time_ + (send_time - last_send_time_);
179 last_send_time_ = send_time; 181 last_send_time_ = send_time;
180 last_arrival_time_ = arrival_time; 182 last_arrival_time_ = arrival_time;
181 return arrival_time; 183 return arrival_time;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 frame_index_(0) { 354 frame_index_(0) {
353 } 355 }
354 356
355 virtual bool Lost() { 357 virtual bool Lost() {
356 return (++frame_index_) % kLossInterval == 0; 358 return (++frame_index_) % kLossInterval == 0;
357 } 359 }
358 360
359 // TODO(hlundin): NetEq is not giving bitexact results for these cases. 361 // TODO(hlundin): NetEq is not giving bitexact results for these cases.
360 virtual void VerifyOutput(size_t num_samples) { 362 virtual void VerifyOutput(size_t num_samples) {
361 for (size_t i = 0; i < num_samples; ++i) { 363 for (size_t i = 0; i < num_samples; ++i) {
364 const int16_t* output_data = output_.data();
365 const int16_t* output_multi_channel_data = output_multi_channel_.data();
362 auto first_channel_sample = 366 auto first_channel_sample =
363 output_multi_channel_.data_[i * num_channels_]; 367 output_multi_channel_data[i * num_channels_];
364 for (size_t j = 0; j < num_channels_; ++j) { 368 for (size_t j = 0; j < num_channels_; ++j) {
365 const int kErrorMargin = 200; 369 const int kErrorMargin = 200;
366 EXPECT_NEAR(output_.data_[i], 370 EXPECT_NEAR(output_data[i],
367 output_multi_channel_.data_[i * num_channels_ + j], 371 output_multi_channel_data[i * num_channels_ + j],
368 kErrorMargin) 372 kErrorMargin)
369 << "Diff in sample " << i << ", channel " << j << "."; 373 << "Diff in sample " << i << ", channel " << j << ".";
370 EXPECT_EQ(first_channel_sample, 374 EXPECT_EQ(first_channel_sample,
371 output_multi_channel_.data_[i * num_channels_ + j]); 375 output_multi_channel_data[i * num_channels_ + j]);
372 } 376 }
373 } 377 }
374 } 378 }
375 379
376 int frame_index_; 380 int frame_index_;
377 }; 381 };
378 382
379 TEST_P(NetEqStereoTestLosses, RunTest) { 383 TEST_P(NetEqStereoTestLosses, RunTest) {
380 RunTest(100); 384 RunTest(100);
381 } 385 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 433
430 INSTANTIATE_TEST_CASE_P(MultiChannel, 434 INSTANTIATE_TEST_CASE_P(MultiChannel,
431 NetEqStereoTestDelays, 435 NetEqStereoTestDelays,
432 ::testing::ValuesIn(GetTestParameters())); 436 ::testing::ValuesIn(GetTestParameters()));
433 437
434 INSTANTIATE_TEST_CASE_P(MultiChannel, 438 INSTANTIATE_TEST_CASE_P(MultiChannel,
435 NetEqStereoTestLosses, 439 NetEqStereoTestLosses,
436 ::testing::ValuesIn(GetTestParameters())); 440 ::testing::ValuesIn(GetTestParameters()));
437 441
438 } // namespace webrtc 442 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/neteq_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698