| OLD | NEW |
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 assert(payload_len == kInputBlockSizeSamples * sizeof(int16_t)); | 99 assert(payload_len == kInputBlockSizeSamples * sizeof(int16_t)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 // Get output audio, but don't do anything with it. | 102 // Get output audio, but don't do anything with it. |
| 103 static const int kMaxChannels = 1; | 103 static const int kMaxChannels = 1; |
| 104 static const size_t kMaxSamplesPerMs = 48000 / 1000; | 104 static const size_t kMaxSamplesPerMs = 48000 / 1000; |
| 105 static const int kOutputBlockSizeMs = 10; | 105 static const int kOutputBlockSizeMs = 10; |
| 106 static const size_t kOutDataLen = | 106 static const size_t kOutDataLen = |
| 107 kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels; | 107 kOutputBlockSizeMs * kMaxSamplesPerMs * kMaxChannels; |
| 108 int16_t out_data[kOutDataLen]; | 108 int16_t out_data[kOutDataLen]; |
| 109 int num_channels; | 109 size_t num_channels; |
| 110 size_t samples_per_channel; | 110 size_t samples_per_channel; |
| 111 int error = neteq->GetAudio(kOutDataLen, out_data, &samples_per_channel, | 111 int error = neteq->GetAudio(kOutDataLen, out_data, &samples_per_channel, |
| 112 &num_channels, NULL); | 112 &num_channels, NULL); |
| 113 if (error != NetEq::kOK) | 113 if (error != NetEq::kOK) |
| 114 return -1; | 114 return -1; |
| 115 | 115 |
| 116 assert(samples_per_channel == static_cast<size_t>(kSampRateHz * 10 / 1000)); | 116 assert(samples_per_channel == static_cast<size_t>(kSampRateHz * 10 / 1000)); |
| 117 | 117 |
| 118 time_now_ms += kOutputBlockSizeMs; | 118 time_now_ms += kOutputBlockSizeMs; |
| 119 if (time_now_ms >= runtime_ms / 2 && !drift_flipped) { | 119 if (time_now_ms >= runtime_ms / 2 && !drift_flipped) { |
| 120 // Apply negative drift second half of simulation. | 120 // Apply negative drift second half of simulation. |
| 121 rtp_gen.set_drift_factor(-drift_factor); | 121 rtp_gen.set_drift_factor(-drift_factor); |
| 122 drift_flipped = true; | 122 drift_flipped = true; |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 int64_t end_time_ms = clock->TimeInMilliseconds(); | 125 int64_t end_time_ms = clock->TimeInMilliseconds(); |
| 126 delete neteq; | 126 delete neteq; |
| 127 return end_time_ms - start_time_ms; | 127 return end_time_ms - start_time_ms; |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace test | 130 } // namespace test |
| 131 } // namespace webrtc | 131 } // namespace webrtc |
| OLD | NEW |