OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include "webrtc/test/direct_transport.h" | 10 #include "webrtc/test/direct_transport.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 packet_event_.Set(); | 63 packet_event_.Set(); |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
67 bool DirectTransport::SendRtcp(const uint8_t* data, size_t length) { | 67 bool DirectTransport::SendRtcp(const uint8_t* data, size_t length) { |
68 fake_network_.SendPacket(data, length); | 68 fake_network_.SendPacket(data, length); |
69 packet_event_.Set(); | 69 packet_event_.Set(); |
70 return true; | 70 return true; |
71 } | 71 } |
72 | 72 |
| 73 int DirectTransport::GetAverageDelayMs() { |
| 74 return fake_network_.AverageDelay(); |
| 75 } |
| 76 |
73 bool DirectTransport::NetworkProcess(void* transport) { | 77 bool DirectTransport::NetworkProcess(void* transport) { |
74 return static_cast<DirectTransport*>(transport)->SendPackets(); | 78 return static_cast<DirectTransport*>(transport)->SendPackets(); |
75 } | 79 } |
76 | 80 |
77 bool DirectTransport::SendPackets() { | 81 bool DirectTransport::SendPackets() { |
78 fake_network_.Process(); | 82 fake_network_.Process(); |
79 int64_t wait_time_ms = fake_network_.TimeUntilNextProcess(); | 83 int64_t wait_time_ms = fake_network_.TimeUntilNextProcess(); |
80 if (wait_time_ms > 0) { | 84 if (wait_time_ms > 0) { |
81 packet_event_.Wait(static_cast<int>(wait_time_ms)); | 85 packet_event_.Wait(static_cast<int>(wait_time_ms)); |
82 } | 86 } |
83 rtc::CritScope crit(&lock_); | 87 rtc::CritScope crit(&lock_); |
84 return shutting_down_ ? false : true; | 88 return shutting_down_ ? false : true; |
85 } | 89 } |
86 } // namespace test | 90 } // namespace test |
87 } // namespace webrtc | 91 } // namespace webrtc |
OLD | NEW |