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