| OLD | NEW |
| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 encoded_multi_channel_); | 157 encoded_multi_channel_); |
| 158 if (frame_size_samples_ * 2 * num_channels_ != multi_payload_size_bytes_) { | 158 if (frame_size_samples_ * 2 * num_channels_ != multi_payload_size_bytes_) { |
| 159 return -1; | 159 return -1; |
| 160 } | 160 } |
| 161 rtp_generator_.GetRtpHeader(kPayloadTypeMulti, frame_size_samples_, | 161 rtp_generator_.GetRtpHeader(kPayloadTypeMulti, frame_size_samples_, |
| 162 &rtp_header_); | 162 &rtp_header_); |
| 163 return next_send_time; | 163 return next_send_time; |
| 164 } | 164 } |
| 165 | 165 |
| 166 virtual void VerifyOutput(size_t num_samples) { | 166 virtual void VerifyOutput(size_t num_samples) { |
| 167 const int16_t* output_data = output_.data(); |
| 168 const int16_t* output_multi_channel_data = output_multi_channel_.data(); |
| 167 for (size_t i = 0; i < num_samples; ++i) { | 169 for (size_t i = 0; i < num_samples; ++i) { |
| 168 for (size_t j = 0; j < num_channels_; ++j) { | 170 for (size_t j = 0; j < num_channels_; ++j) { |
| 169 ASSERT_EQ(output_.data_[i], | 171 ASSERT_EQ(output_data[i], |
| 170 output_multi_channel_.data_[i * num_channels_ + j]) | 172 output_multi_channel_data[i * num_channels_ + j]) |
| 171 << "Diff in sample " << i << ", channel " << j << "."; | 173 << "Diff in sample " << i << ", channel " << j << "."; |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 } | 176 } |
| 175 | 177 |
| 176 virtual int GetArrivalTime(int send_time) { | 178 virtual int GetArrivalTime(int send_time) { |
| 177 int arrival_time = last_arrival_time_ + (send_time - last_send_time_); | 179 int arrival_time = last_arrival_time_ + (send_time - last_send_time_); |
| 178 last_send_time_ = send_time; | 180 last_send_time_ = send_time; |
| 179 last_arrival_time_ = arrival_time; | 181 last_arrival_time_ = arrival_time; |
| 180 return arrival_time; | 182 return arrival_time; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 frame_index_(0) { | 352 frame_index_(0) { |
| 351 } | 353 } |
| 352 | 354 |
| 353 virtual bool Lost() { | 355 virtual bool Lost() { |
| 354 return (++frame_index_) % kLossInterval == 0; | 356 return (++frame_index_) % kLossInterval == 0; |
| 355 } | 357 } |
| 356 | 358 |
| 357 // TODO(hlundin): NetEq is not giving bitexact results for these cases. | 359 // TODO(hlundin): NetEq is not giving bitexact results for these cases. |
| 358 virtual void VerifyOutput(size_t num_samples) { | 360 virtual void VerifyOutput(size_t num_samples) { |
| 359 for (size_t i = 0; i < num_samples; ++i) { | 361 for (size_t i = 0; i < num_samples; ++i) { |
| 362 const int16_t* output_data = output_.data(); |
| 363 const int16_t* output_multi_channel_data = output_multi_channel_.data(); |
| 360 auto first_channel_sample = | 364 auto first_channel_sample = |
| 361 output_multi_channel_.data_[i * num_channels_]; | 365 output_multi_channel_data[i * num_channels_]; |
| 362 for (size_t j = 0; j < num_channels_; ++j) { | 366 for (size_t j = 0; j < num_channels_; ++j) { |
| 363 const int kErrorMargin = 200; | 367 const int kErrorMargin = 200; |
| 364 EXPECT_NEAR(output_.data_[i], | 368 EXPECT_NEAR(output_data[i], |
| 365 output_multi_channel_.data_[i * num_channels_ + j], | 369 output_multi_channel_data[i * num_channels_ + j], |
| 366 kErrorMargin) | 370 kErrorMargin) |
| 367 << "Diff in sample " << i << ", channel " << j << "."; | 371 << "Diff in sample " << i << ", channel " << j << "."; |
| 368 EXPECT_EQ(first_channel_sample, | 372 EXPECT_EQ(first_channel_sample, |
| 369 output_multi_channel_.data_[i * num_channels_ + j]); | 373 output_multi_channel_data[i * num_channels_ + j]); |
| 370 } | 374 } |
| 371 } | 375 } |
| 372 } | 376 } |
| 373 | 377 |
| 374 int frame_index_; | 378 int frame_index_; |
| 375 }; | 379 }; |
| 376 | 380 |
| 377 TEST_P(NetEqStereoTestLosses, RunTest) { | 381 TEST_P(NetEqStereoTestLosses, RunTest) { |
| 378 RunTest(100); | 382 RunTest(100); |
| 379 } | 383 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 431 |
| 428 INSTANTIATE_TEST_CASE_P(MultiChannel, | 432 INSTANTIATE_TEST_CASE_P(MultiChannel, |
| 429 NetEqStereoTestDelays, | 433 NetEqStereoTestDelays, |
| 430 ::testing::ValuesIn(GetTestParameters())); | 434 ::testing::ValuesIn(GetTestParameters())); |
| 431 | 435 |
| 432 INSTANTIATE_TEST_CASE_P(MultiChannel, | 436 INSTANTIATE_TEST_CASE_P(MultiChannel, |
| 433 NetEqStereoTestLosses, | 437 NetEqStereoTestLosses, |
| 434 ::testing::ValuesIn(GetTestParameters())); | 438 ::testing::ValuesIn(GetTestParameters())); |
| 435 | 439 |
| 436 } // namespace webrtc | 440 } // namespace webrtc |
| OLD | NEW |