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