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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 size_t payload_len = WebRtcPcm16b_Encode(input_samples.data(), | 73 size_t payload_len = WebRtcPcm16b_Encode(input_samples.data(), |
74 input_samples.size(), input_payload); | 74 input_samples.size(), input_payload); |
75 RTC_CHECK_EQ(sizeof(input_payload), payload_len); | 75 RTC_CHECK_EQ(sizeof(input_payload), payload_len); |
76 | 76 |
77 // Main loop. | 77 // Main loop. |
78 webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock(); | 78 webrtc::Clock* clock = webrtc::Clock::GetRealTimeClock(); |
79 int64_t start_time_ms = clock->TimeInMilliseconds(); | 79 int64_t start_time_ms = clock->TimeInMilliseconds(); |
80 AudioFrame out_frame; | 80 AudioFrame out_frame; |
81 while (time_now_ms < runtime_ms) { | 81 while (time_now_ms < runtime_ms) { |
82 while (packet_input_time_ms <= time_now_ms) { | 82 while (packet_input_time_ms <= time_now_ms) { |
83 // Drop every N packets, where N = FLAGS_lossrate. | 83 // Drop every N packets, where N = FLAG_lossrate. |
84 bool lost = false; | 84 bool lost = false; |
85 if (lossrate > 0) { | 85 if (lossrate > 0) { |
86 lost = ((rtp_header.sequenceNumber - 1) % lossrate) == 0; | 86 lost = ((rtp_header.sequenceNumber - 1) % lossrate) == 0; |
87 } | 87 } |
88 if (!lost) { | 88 if (!lost) { |
89 // Insert packet. | 89 // Insert packet. |
90 int error = | 90 int error = |
91 neteq->InsertPacket(rtp_header, input_payload, | 91 neteq->InsertPacket(rtp_header, input_payload, |
92 packet_input_time_ms * kSampRateHz / 1000); | 92 packet_input_time_ms * kSampRateHz / 1000); |
93 if (error != NetEq::kOK) | 93 if (error != NetEq::kOK) |
(...skipping 30 matching lines...) Expand all Loading... |
124 drift_flipped = true; | 124 drift_flipped = true; |
125 } | 125 } |
126 } | 126 } |
127 int64_t end_time_ms = clock->TimeInMilliseconds(); | 127 int64_t end_time_ms = clock->TimeInMilliseconds(); |
128 delete neteq; | 128 delete neteq; |
129 return end_time_ms - start_time_ms; | 129 return end_time_ms - start_time_ms; |
130 } | 130 } |
131 | 131 |
132 } // namespace test | 132 } // namespace test |
133 } // namespace webrtc | 133 } // namespace webrtc |
OLD | NEW |