OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 { | 69 { |
70 CritScope cs(&crit_); | 70 CritScope cs(&crit_); |
71 if (packets_->size() != 0) { | 71 if (packets_->size() != 0) { |
72 break; | 72 break; |
73 } | 73 } |
74 } | 74 } |
75 Thread::Current()->ProcessMessages(1); | 75 Thread::Current()->ProcessMessages(1); |
76 } | 76 } |
77 | 77 |
78 // Return the first packet placed in the queue. | 78 // Return the first packet placed in the queue. |
79 Packet* packet = NULL; | 79 Packet* packet = nullptr; |
80 CritScope cs(&crit_); | 80 CritScope cs(&crit_); |
81 if (packets_->size() > 0) { | 81 if (packets_->size() > 0) { |
82 packet = packets_->front(); | 82 packet = packets_->front(); |
83 packets_->erase(packets_->begin()); | 83 packets_->erase(packets_->begin()); |
84 } | 84 } |
85 | 85 |
86 return packet; | 86 return packet; |
87 } | 87 } |
88 | 88 |
89 bool TestClient::CheckNextPacket(const char* buf, size_t size, | 89 bool TestClient::CheckNextPacket(const char* buf, size_t size, |
(...skipping 20 matching lines...) Expand all Loading... |
110 res = false; | 110 res = false; |
111 } | 111 } |
112 } | 112 } |
113 prev_packet_timestamp_ = packet_timestamp; | 113 prev_packet_timestamp_ = packet_timestamp; |
114 return res; | 114 return res; |
115 } | 115 } |
116 | 116 |
117 bool TestClient::CheckNoPacket() { | 117 bool TestClient::CheckNoPacket() { |
118 bool res; | 118 bool res; |
119 Packet* packet = NextPacket(kNoPacketTimeoutMs); | 119 Packet* packet = NextPacket(kNoPacketTimeoutMs); |
120 res = (packet == NULL); | 120 res = (packet == nullptr); |
121 delete packet; | 121 delete packet; |
122 return res; | 122 return res; |
123 } | 123 } |
124 | 124 |
125 int TestClient::GetError() { | 125 int TestClient::GetError() { |
126 return socket_->GetError(); | 126 return socket_->GetError(); |
127 } | 127 } |
128 | 128 |
129 int TestClient::SetOption(Socket::Option opt, int value) { | 129 int TestClient::SetOption(Socket::Option opt, int value) { |
130 return socket_->SetOption(opt, value); | 130 return socket_->SetOption(opt, value); |
(...skipping 23 matching lines...) Expand all Loading... |
154 : addr(p.addr), buf(0), size(p.size), packet_time(p.packet_time) { | 154 : addr(p.addr), buf(0), size(p.size), packet_time(p.packet_time) { |
155 buf = new char[size]; | 155 buf = new char[size]; |
156 memcpy(buf, p.buf, size); | 156 memcpy(buf, p.buf, size); |
157 } | 157 } |
158 | 158 |
159 TestClient::Packet::~Packet() { | 159 TestClient::Packet::~Packet() { |
160 delete[] buf; | 160 delete[] buf; |
161 } | 161 } |
162 | 162 |
163 } // namespace rtc | 163 } // namespace rtc |
OLD | NEW |