Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: webrtc/media/sctp/sctptransport.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Fix the memory leak. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/media/sctp/sctptransport.h ('k') | webrtc/media/sctp/sctptransport_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
42 43
43 namespace { 44 namespace {
44 45
45 // The biggest SCTP packet. Starting from a 'safe' wire MTU value of 1280, 46 // The biggest SCTP packet. Starting from a 'safe' wire MTU value of 1280,
46 // take off 80 bytes for DTLS/TURN/TCP/IP overhead. 47 // take off 80 bytes for DTLS/TURN/TCP/IP overhead.
47 static constexpr size_t kSctpMtu = 1200; 48 static constexpr size_t kSctpMtu = 1200;
48 49
49 // The size of the SCTP association send buffer. 256kB, the usrsctp default. 50 // The size of the SCTP association send buffer. 256kB, the usrsctp default.
50 static constexpr int kSendBufferSize = 262144; 51 static constexpr int kSendBufferSize = 262144;
51 52
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 << "SendThresholdCallback: Failed to get transport for socket " 378 << "SendThresholdCallback: Failed to get transport for socket "
378 << sock; 379 << sock;
379 return 0; 380 return 0;
380 } 381 }
381 transport->OnSendThresholdCallback(); 382 transport->OnSendThresholdCallback();
382 return 0; 383 return 0;
383 } 384 }
384 }; 385 };
385 386
386 SctpTransport::SctpTransport(rtc::Thread* network_thread, 387 SctpTransport::SctpTransport(rtc::Thread* network_thread,
387 TransportChannel* channel) 388 rtc::PacketTransportInterface* channel)
388 : network_thread_(network_thread), 389 : network_thread_(network_thread),
389 transport_channel_(channel), 390 transport_channel_(channel),
390 was_ever_writable_(channel->writable()) { 391 was_ever_writable_(channel->writable()) {
391 RTC_DCHECK(network_thread_); 392 RTC_DCHECK(network_thread_);
392 RTC_DCHECK(transport_channel_); 393 RTC_DCHECK(transport_channel_);
393 RTC_DCHECK_RUN_ON(network_thread_); 394 RTC_DCHECK_RUN_ON(network_thread_);
394 ConnectTransportChannelSignals(); 395 ConnectTransportChannelSignals();
395 } 396 }
396 397
397 SctpTransport::~SctpTransport() { 398 SctpTransport::~SctpTransport() {
398 // Close abruptly; no reset procedure. 399 // Close abruptly; no reset procedure.
399 CloseSctpSocket(); 400 CloseSctpSocket();
400 } 401 }
401 402
402 void SctpTransport::SetTransportChannel(cricket::TransportChannel* channel) { 403 void SctpTransport::SetTransportChannel(
404 rtc::PacketTransportInterface* channel) {
403 RTC_DCHECK_RUN_ON(network_thread_); 405 RTC_DCHECK_RUN_ON(network_thread_);
404 RTC_DCHECK(channel); 406 RTC_DCHECK(channel);
405 DisconnectTransportChannelSignals(); 407 DisconnectTransportChannelSignals();
406 transport_channel_ = channel; 408 transport_channel_ = channel;
407 ConnectTransportChannelSignals(); 409 ConnectTransportChannelSignals();
408 if (!was_ever_writable_ && channel->writable()) { 410 if (!was_ever_writable_ && channel->writable()) {
409 was_ever_writable_ = true; 411 was_ever_writable_ = true;
410 // New channel is writable, now we can start the SCTP connection if Start 412 // New channel is writable, now we can start the SCTP connection if Start
411 // was called already. 413 // was called already.
412 if (started_) { 414 if (started_) {
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 } 1083 }
1082 } 1084 }
1083 } 1085 }
1084 1086
1085 // Always try to send the queued RESET because this call indicates that the 1087 // Always try to send the queued RESET because this call indicates that the
1086 // last local RESET or remote RESET has made some progress. 1088 // last local RESET or remote RESET has made some progress.
1087 SendQueuedStreamResets(); 1089 SendQueuedStreamResets();
1088 } 1090 }
1089 1091
1090 } // namespace cricket 1092 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/sctp/sctptransport.h ('k') | webrtc/media/sctp/sctptransport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698