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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 this, &P2PTransportChannel::OnCandidatesAllocationDone); | 247 this, &P2PTransportChannel::OnCandidatesAllocationDone); |
248 session->StartGettingPorts(); | 248 session->StartGettingPorts(); |
249 } | 249 } |
250 | 250 |
251 void P2PTransportChannel::AddConnection(Connection* connection) { | 251 void P2PTransportChannel::AddConnection(Connection* connection) { |
252 connections_.push_back(connection); | 252 connections_.push_back(connection); |
253 connection->set_remote_ice_mode(remote_ice_mode_); | 253 connection->set_remote_ice_mode(remote_ice_mode_); |
254 connection->set_receiving_timeout(receiving_timeout_); | 254 connection->set_receiving_timeout(receiving_timeout_); |
255 connection->SignalReadPacket.connect( | 255 connection->SignalReadPacket.connect( |
256 this, &P2PTransportChannel::OnReadPacket); | 256 this, &P2PTransportChannel::OnReadPacket); |
257 connection->SignalSentPacket.connect(this, | |
258 &P2PTransportChannel::OnSentPacket); | |
257 connection->SignalReadyToSend.connect( | 259 connection->SignalReadyToSend.connect( |
258 this, &P2PTransportChannel::OnReadyToSend); | 260 this, &P2PTransportChannel::OnReadyToSend); |
259 connection->SignalStateChange.connect( | 261 connection->SignalStateChange.connect( |
260 this, &P2PTransportChannel::OnConnectionStateChange); | 262 this, &P2PTransportChannel::OnConnectionStateChange); |
261 connection->SignalDestroyed.connect( | 263 connection->SignalDestroyed.connect( |
262 this, &P2PTransportChannel::OnConnectionDestroyed); | 264 this, &P2PTransportChannel::OnConnectionDestroyed); |
263 connection->SignalNominated.connect(this, &P2PTransportChannel::OnNominated); | 265 connection->SignalNominated.connect(this, &P2PTransportChannel::OnNominated); |
264 had_connection_ = true; | 266 had_connection_ = true; |
265 } | 267 } |
266 | 268 |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1335 SignalReadPacket(this, data, len, packet_time, 0); | 1337 SignalReadPacket(this, data, len, packet_time, 0); |
1336 | 1338 |
1337 // May need to switch the sending connection based on the receiving media path | 1339 // May need to switch the sending connection based on the receiving media path |
1338 // if this is the controlled side. | 1340 // if this is the controlled side. |
1339 if (ice_role_ == ICEROLE_CONTROLLED && !best_nominated_connection() && | 1341 if (ice_role_ == ICEROLE_CONTROLLED && !best_nominated_connection() && |
1340 connection->writable() && best_connection_ != connection) { | 1342 connection->writable() && best_connection_ != connection) { |
1341 SwitchBestConnectionTo(connection); | 1343 SwitchBestConnectionTo(connection); |
1342 } | 1344 } |
1343 } | 1345 } |
1344 | 1346 |
1347 void P2PTransportChannel::OnSentPacket(Connection* connection, | |
1348 const rtc::SentPacket& packet_sent) { | |
1349 ASSERT(worker_thread_ == rtc::Thread::Current()); | |
1350 | |
1351 // Do not deliver if packet doesn't belong to the correct transport channel. | |
1352 if (!FindConnection(connection)) | |
pthatcher1
2015/09/25 23:24:58
I don't think this check is necessary. And, do we
stefan-webrtc
2015/09/28 12:10:50
I mostly did this to follow the convention in OnRe
pthatcher1
2015/09/28 23:58:40
I don't really think the check in OnReadPacket is
stefan-webrtc
2015/10/02 13:29:12
No, that doesn't make a lot of sense. Fixing.
| |
1353 return; | |
1354 | |
1355 SignalSentPacket(this, packet_sent); | |
1356 } | |
1357 | |
1345 void P2PTransportChannel::OnReadyToSend(Connection* connection) { | 1358 void P2PTransportChannel::OnReadyToSend(Connection* connection) { |
1346 if (connection == best_connection_ && writable()) { | 1359 if (connection == best_connection_ && writable()) { |
1347 SignalReadyToSend(this); | 1360 SignalReadyToSend(this); |
1348 } | 1361 } |
1349 } | 1362 } |
1350 | 1363 |
1351 } // namespace cricket | 1364 } // namespace cricket |
OLD | NEW |