| 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 |
| 11 #include "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h" | 11 #include "webrtc/modules/audio_coding/neteq/tools/neteq_performance_test.h" |
| 12 | 12 |
| 13 #include "webrtc/base/checks.h" |
| 13 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" | 14 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" |
| 14 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" | 15 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" |
| 15 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" | 16 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" |
| 16 #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h" | 17 #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h" |
| 17 #include "webrtc/modules/include/module_common_types.h" | 18 #include "webrtc/modules/include/module_common_types.h" |
| 18 #include "webrtc/system_wrappers/include/clock.h" | 19 #include "webrtc/system_wrappers/include/clock.h" |
| 19 #include "webrtc/test/testsupport/fileutils.h" | 20 #include "webrtc/test/testsupport/fileutils.h" |
| 20 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
| 21 | 22 |
| 22 using webrtc::NetEq; | 23 using webrtc::NetEq; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 &rtp_header); | 99 &rtp_header); |
| 99 input_samples = audio_loop.GetNextBlock(); | 100 input_samples = audio_loop.GetNextBlock(); |
| 100 if (input_samples.empty()) | 101 if (input_samples.empty()) |
| 101 return -1; | 102 return -1; |
| 102 payload_len = WebRtcPcm16b_Encode(input_samples.data(), | 103 payload_len = WebRtcPcm16b_Encode(input_samples.data(), |
| 103 input_samples.size(), input_payload); | 104 input_samples.size(), input_payload); |
| 104 assert(payload_len == kInputBlockSizeSamples * sizeof(int16_t)); | 105 assert(payload_len == kInputBlockSizeSamples * sizeof(int16_t)); |
| 105 } | 106 } |
| 106 | 107 |
| 107 // Get output audio, but don't do anything with it. | 108 // Get output audio, but don't do anything with it. |
| 108 int error = neteq->GetAudio(&out_frame); | 109 bool muted; |
| 110 int error = neteq->GetAudio(&out_frame, &muted); |
| 111 RTC_CHECK(!muted); |
| 109 if (error != NetEq::kOK) | 112 if (error != NetEq::kOK) |
| 110 return -1; | 113 return -1; |
| 111 | 114 |
| 112 assert(out_frame.samples_per_channel_ == | 115 assert(out_frame.samples_per_channel_ == |
| 113 static_cast<size_t>(kSampRateHz * 10 / 1000)); | 116 static_cast<size_t>(kSampRateHz * 10 / 1000)); |
| 114 | 117 |
| 115 static const int kOutputBlockSizeMs = 10; | 118 static const int kOutputBlockSizeMs = 10; |
| 116 time_now_ms += kOutputBlockSizeMs; | 119 time_now_ms += kOutputBlockSizeMs; |
| 117 if (time_now_ms >= runtime_ms / 2 && !drift_flipped) { | 120 if (time_now_ms >= runtime_ms / 2 && !drift_flipped) { |
| 118 // Apply negative drift second half of simulation. | 121 // Apply negative drift second half of simulation. |
| 119 rtp_gen.set_drift_factor(-drift_factor); | 122 rtp_gen.set_drift_factor(-drift_factor); |
| 120 drift_flipped = true; | 123 drift_flipped = true; |
| 121 } | 124 } |
| 122 } | 125 } |
| 123 int64_t end_time_ms = clock->TimeInMilliseconds(); | 126 int64_t end_time_ms = clock->TimeInMilliseconds(); |
| 124 delete neteq; | 127 delete neteq; |
| 125 return end_time_ms - start_time_ms; | 128 return end_time_ms - start_time_ms; |
| 126 } | 129 } |
| 127 | 130 |
| 128 } // namespace test | 131 } // namespace test |
| 129 } // namespace webrtc | 132 } // namespace webrtc |
| OLD | NEW |