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 1479 matching lines...) Loading... |
1490 SignalStateChange(this); | 1490 SignalStateChange(this); |
1491 } | 1491 } |
1492 | 1492 |
1493 ProxyConnection::ProxyConnection(Port* port, | 1493 ProxyConnection::ProxyConnection(Port* port, |
1494 size_t index, | 1494 size_t index, |
1495 const Candidate& remote_candidate) | 1495 const Candidate& remote_candidate) |
1496 : Connection(port, index, remote_candidate) {} | 1496 : Connection(port, index, remote_candidate) {} |
1497 | 1497 |
1498 int ProxyConnection::Send(const void* data, size_t size, | 1498 int ProxyConnection::Send(const void* data, size_t size, |
1499 const rtc::PacketOptions& options) { | 1499 const rtc::PacketOptions& options) { |
1500 if (write_state_ == STATE_WRITE_INIT || write_state_ == STATE_WRITE_TIMEOUT) { | 1500 if (!ReadyToSendMedia()) { |
1501 error_ = EWOULDBLOCK; | 1501 error_ = EWOULDBLOCK; |
1502 return SOCKET_ERROR; | 1502 return SOCKET_ERROR; |
1503 } | 1503 } |
1504 stats_.sent_total_packets++; | 1504 stats_.sent_total_packets++; |
1505 int sent = port_->SendTo(data, size, remote_candidate_.address(), | 1505 int sent = port_->SendTo(data, size, remote_candidate_.address(), |
1506 options, true); | 1506 options, true); |
1507 if (sent <= 0) { | 1507 if (sent <= 0) { |
1508 ASSERT(sent < 0); | 1508 ASSERT(sent < 0); |
1509 error_ = port_->GetError(); | 1509 error_ = port_->GetError(); |
1510 stats_.sent_discarded_packets++; | 1510 stats_.sent_discarded_packets++; |
1511 } else { | 1511 } else { |
1512 send_rate_tracker_.AddSamples(sent); | 1512 send_rate_tracker_.AddSamples(sent); |
1513 } | 1513 } |
1514 return sent; | 1514 return sent; |
1515 } | 1515 } |
1516 | 1516 |
1517 } // namespace cricket | 1517 } // namespace cricket |
OLD | NEW |