OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 19 matching lines...) Expand all Loading... |
30 #include "webrtc/base/arraysize.h" | 30 #include "webrtc/base/arraysize.h" |
31 #include "webrtc/base/copyonwritebuffer.h" | 31 #include "webrtc/base/copyonwritebuffer.h" |
32 #include "webrtc/base/criticalsection.h" | 32 #include "webrtc/base/criticalsection.h" |
33 #include "webrtc/base/helpers.h" | 33 #include "webrtc/base/helpers.h" |
34 #include "webrtc/base/logging.h" | 34 #include "webrtc/base/logging.h" |
35 #include "webrtc/base/safe_conversions.h" | 35 #include "webrtc/base/safe_conversions.h" |
36 #include "webrtc/base/thread_checker.h" | 36 #include "webrtc/base/thread_checker.h" |
37 #include "webrtc/base/trace_event.h" | 37 #include "webrtc/base/trace_event.h" |
38 #include "webrtc/media/base/codec.h" | 38 #include "webrtc/media/base/codec.h" |
39 #include "webrtc/media/base/mediaconstants.h" | 39 #include "webrtc/media/base/mediaconstants.h" |
40 #include "webrtc/media/base/rtputils.h" // For IsRtpPacket | |
41 #include "webrtc/media/base/streamparams.h" | 40 #include "webrtc/media/base/streamparams.h" |
42 #include "webrtc/p2p/base/dtlstransportinternal.h" // For PF_NORMAL | 41 #include "webrtc/p2p/base/dtlstransportinternal.h" // For PF_NORMAL |
43 | 42 |
44 namespace { | 43 namespace { |
45 | 44 |
46 // The biggest SCTP packet. Starting from a 'safe' wire MTU value of 1280, | 45 // The biggest SCTP packet. Starting from a 'safe' wire MTU value of 1280, |
47 // take off 80 bytes for DTLS/TURN/TCP/IP overhead. | 46 // take off 80 bytes for DTLS/TURN/TCP/IP overhead. |
48 static constexpr size_t kSctpMtu = 1200; | 47 static constexpr size_t kSctpMtu = 1200; |
49 | 48 |
50 // The size of the SCTP association send buffer. 256kB, the usrsctp default. | 49 // The size of the SCTP association send buffer. 256kB, the usrsctp default. |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 // Called by network interface when a packet has been received. | 820 // Called by network interface when a packet has been received. |
822 void SctpTransport::OnPacketRead(rtc::PacketTransportInternal* transport, | 821 void SctpTransport::OnPacketRead(rtc::PacketTransportInternal* transport, |
823 const char* data, | 822 const char* data, |
824 size_t len, | 823 size_t len, |
825 const rtc::PacketTime& packet_time, | 824 const rtc::PacketTime& packet_time, |
826 int flags) { | 825 int flags) { |
827 RTC_DCHECK_RUN_ON(network_thread_); | 826 RTC_DCHECK_RUN_ON(network_thread_); |
828 RTC_DCHECK_EQ(transport_channel_, transport); | 827 RTC_DCHECK_EQ(transport_channel_, transport); |
829 TRACE_EVENT0("webrtc", "SctpTransport::OnPacketRead"); | 828 TRACE_EVENT0("webrtc", "SctpTransport::OnPacketRead"); |
830 | 829 |
831 // TODO(pthatcher): Do this in a more robust way by checking for | 830 if (flags & PF_SRTP_BYPASS) { |
832 // SCTP or DTLS. | 831 // We are only interested in SCTP packets. |
833 if (IsRtpPacket(data, len)) { | |
834 return; | 832 return; |
835 } | 833 } |
836 | 834 |
837 LOG(LS_VERBOSE) << debug_name_ << "->OnPacketRead(...): " | 835 LOG(LS_VERBOSE) << debug_name_ << "->OnPacketRead(...): " |
838 << " length=" << len << ", started: " << started_; | 836 << " length=" << len << ", started: " << started_; |
839 // Only give receiving packets to usrsctp after if connected. This enables two | 837 // Only give receiving packets to usrsctp after if connected. This enables two |
840 // peers to each make a connect call, but for them not to receive an INIT | 838 // peers to each make a connect call, but for them not to receive an INIT |
841 // packet before they have called connect; least the last receiver of the INIT | 839 // packet before they have called connect; least the last receiver of the INIT |
842 // packet will have called connect, and a connection will be established. | 840 // packet will have called connect, and a connection will be established. |
843 if (sock_) { | 841 if (sock_) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 } | 1080 } |
1083 } | 1081 } |
1084 } | 1082 } |
1085 | 1083 |
1086 // Always try to send the queued RESET because this call indicates that the | 1084 // Always try to send the queued RESET because this call indicates that the |
1087 // last local RESET or remote RESET has made some progress. | 1085 // last local RESET or remote RESET has made some progress. |
1088 SendQueuedStreamResets(); | 1086 SendQueuedStreamResets(); |
1089 } | 1087 } |
1090 | 1088 |
1091 } // namespace cricket | 1089 } // namespace cricket |
OLD | NEW |