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 21 matching lines...) Expand all Loading... |
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 | 40 #include "webrtc/media/base/rtputils.h" // For IsRtpPacket |
41 #include "webrtc/media/base/streamparams.h" | 41 #include "webrtc/media/base/streamparams.h" |
42 #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. |
51 static constexpr int kSendBufferSize = 262144; | 50 static constexpr int kSendBufferSize = 262144; |
52 | 51 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 << "SendThresholdCallback: Failed to get transport for socket " | 377 << "SendThresholdCallback: Failed to get transport for socket " |
379 << sock; | 378 << sock; |
380 return 0; | 379 return 0; |
381 } | 380 } |
382 transport->OnSendThresholdCallback(); | 381 transport->OnSendThresholdCallback(); |
383 return 0; | 382 return 0; |
384 } | 383 } |
385 }; | 384 }; |
386 | 385 |
387 SctpTransport::SctpTransport(rtc::Thread* network_thread, | 386 SctpTransport::SctpTransport(rtc::Thread* network_thread, |
388 rtc::PacketTransportInterface* channel) | 387 TransportChannel* channel) |
389 : network_thread_(network_thread), | 388 : network_thread_(network_thread), |
390 transport_channel_(channel), | 389 transport_channel_(channel), |
391 was_ever_writable_(channel->writable()) { | 390 was_ever_writable_(channel->writable()) { |
392 RTC_DCHECK(network_thread_); | 391 RTC_DCHECK(network_thread_); |
393 RTC_DCHECK(transport_channel_); | 392 RTC_DCHECK(transport_channel_); |
394 RTC_DCHECK_RUN_ON(network_thread_); | 393 RTC_DCHECK_RUN_ON(network_thread_); |
395 ConnectTransportChannelSignals(); | 394 ConnectTransportChannelSignals(); |
396 } | 395 } |
397 | 396 |
398 SctpTransport::~SctpTransport() { | 397 SctpTransport::~SctpTransport() { |
399 // Close abruptly; no reset procedure. | 398 // Close abruptly; no reset procedure. |
400 CloseSctpSocket(); | 399 CloseSctpSocket(); |
401 } | 400 } |
402 | 401 |
403 void SctpTransport::SetTransportChannel( | 402 void SctpTransport::SetTransportChannel(cricket::TransportChannel* channel) { |
404 rtc::PacketTransportInterface* channel) { | |
405 RTC_DCHECK_RUN_ON(network_thread_); | 403 RTC_DCHECK_RUN_ON(network_thread_); |
406 RTC_DCHECK(channel); | 404 RTC_DCHECK(channel); |
407 DisconnectTransportChannelSignals(); | 405 DisconnectTransportChannelSignals(); |
408 transport_channel_ = channel; | 406 transport_channel_ = channel; |
409 ConnectTransportChannelSignals(); | 407 ConnectTransportChannelSignals(); |
410 if (!was_ever_writable_ && channel->writable()) { | 408 if (!was_ever_writable_ && channel->writable()) { |
411 was_ever_writable_ = true; | 409 was_ever_writable_ = true; |
412 // New channel is writable, now we can start the SCTP connection if Start | 410 // New channel is writable, now we can start the SCTP connection if Start |
413 // was called already. | 411 // was called already. |
414 if (started_) { | 412 if (started_) { |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 } | 1081 } |
1084 } | 1082 } |
1085 } | 1083 } |
1086 | 1084 |
1087 // Always try to send the queued RESET because this call indicates that the | 1085 // Always try to send the queued RESET because this call indicates that the |
1088 // last local RESET or remote RESET has made some progress. | 1086 // last local RESET or remote RESET has made some progress. |
1089 SendQueuedStreamResets(); | 1087 SendQueuedStreamResets(); |
1090 } | 1088 } |
1091 | 1089 |
1092 } // namespace cricket | 1090 } // namespace cricket |
OLD | NEW |