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

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

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return PPID_CONTROL; 154 return PPID_CONTROL;
155 case cricket::DMT_BINARY: 155 case cricket::DMT_BINARY:
156 return PPID_BINARY_LAST; 156 return PPID_BINARY_LAST;
157 case cricket::DMT_TEXT: 157 case cricket::DMT_TEXT:
158 return PPID_TEXT_LAST; 158 return PPID_TEXT_LAST;
159 } 159 }
160 } 160 }
161 161
162 bool GetDataMediaType(PayloadProtocolIdentifier ppid, 162 bool GetDataMediaType(PayloadProtocolIdentifier ppid,
163 cricket::DataMessageType* dest) { 163 cricket::DataMessageType* dest) {
164 RTC_DCHECK(dest != NULL); 164 RTC_DCHECK(dest != nullptr);
165 switch (ppid) { 165 switch (ppid) {
166 case PPID_BINARY_PARTIAL: 166 case PPID_BINARY_PARTIAL:
167 case PPID_BINARY_LAST: 167 case PPID_BINARY_LAST:
168 *dest = cricket::DMT_BINARY; 168 *dest = cricket::DMT_BINARY;
169 return true; 169 return true;
170 170
171 case PPID_TEXT_PARTIAL: 171 case PPID_TEXT_PARTIAL:
172 case PPID_TEXT_LAST: 172 case PPID_TEXT_LAST:
173 *dest = cricket::DMT_TEXT; 173 *dest = cricket::DMT_TEXT;
174 return true; 174 return true;
(...skipping 12 matching lines...) Expand all
187 } 187 }
188 188
189 // Log the packet in text2pcap format, if log level is at LS_VERBOSE. 189 // Log the packet in text2pcap format, if log level is at LS_VERBOSE.
190 void VerboseLogPacket(const void* data, size_t length, int direction) { 190 void VerboseLogPacket(const void* data, size_t length, int direction) {
191 if (LOG_CHECK_LEVEL(LS_VERBOSE) && length > 0) { 191 if (LOG_CHECK_LEVEL(LS_VERBOSE) && length > 0) {
192 char* dump_buf; 192 char* dump_buf;
193 // Some downstream project uses an older version of usrsctp that expects 193 // Some downstream project uses an older version of usrsctp that expects
194 // a non-const "void*" as first parameter when dumping the packet, so we 194 // a non-const "void*" as first parameter when dumping the packet, so we
195 // need to cast the const away here to avoid a compiler error. 195 // need to cast the const away here to avoid a compiler error.
196 if ((dump_buf = usrsctp_dumppacket(const_cast<void*>(data), length, 196 if ((dump_buf = usrsctp_dumppacket(const_cast<void*>(data), length,
197 direction)) != NULL) { 197 direction)) != nullptr) {
198 LOG(LS_VERBOSE) << dump_buf; 198 LOG(LS_VERBOSE) << dump_buf;
199 usrsctp_freedumpbuffer(dump_buf); 199 usrsctp_freedumpbuffer(dump_buf);
200 } 200 }
201 } 201 }
202 } 202 }
203 203
204 } // namespace 204 } // namespace
205 205
206 namespace cricket { 206 namespace cricket {
207 207
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 spa.sendv_prinfo.pr_value = params.max_rtx_count; 536 spa.sendv_prinfo.pr_value = params.max_rtx_count;
537 } else { 537 } else {
538 spa.sendv_flags |= SCTP_SEND_PRINFO_VALID; 538 spa.sendv_flags |= SCTP_SEND_PRINFO_VALID;
539 spa.sendv_prinfo.pr_policy = SCTP_PR_SCTP_TTL; 539 spa.sendv_prinfo.pr_policy = SCTP_PR_SCTP_TTL;
540 spa.sendv_prinfo.pr_value = params.max_rtx_ms; 540 spa.sendv_prinfo.pr_value = params.max_rtx_ms;
541 } 541 }
542 } 542 }
543 543
544 // We don't fragment. 544 // We don't fragment.
545 send_res = usrsctp_sendv( 545 send_res = usrsctp_sendv(
546 sock_, payload.data(), static_cast<size_t>(payload.size()), NULL, 0, &spa, 546 sock_, payload.data(), static_cast<size_t>(payload.size()), nullptr, 0,
547 rtc::checked_cast<socklen_t>(sizeof(spa)), SCTP_SENDV_SPA, 0); 547 &spa, rtc::checked_cast<socklen_t>(sizeof(spa)), SCTP_SENDV_SPA, 0);
548 if (send_res < 0) { 548 if (send_res < 0) {
549 if (errno == SCTP_EWOULDBLOCK) { 549 if (errno == SCTP_EWOULDBLOCK) {
550 *result = SDR_BLOCK; 550 *result = SDR_BLOCK;
551 ready_to_send_data_ = false; 551 ready_to_send_data_ = false;
552 LOG(LS_INFO) << debug_name_ << "->SendData(...): EWOULDBLOCK returned"; 552 LOG(LS_INFO) << debug_name_ << "->SendData(...): EWOULDBLOCK returned";
553 } else { 553 } else {
554 LOG_ERRNO(LS_ERROR) << "ERROR:" << debug_name_ << "->SendData(...): " 554 LOG_ERRNO(LS_ERROR) << "ERROR:" << debug_name_ << "->SendData(...): "
555 << " usrsctp_sendv: "; 555 << " usrsctp_sendv: ";
556 } 556 }
557 return false; 557 return false;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 void SctpTransport::OnInboundPacketFromSctpToChannel( 894 void SctpTransport::OnInboundPacketFromSctpToChannel(
895 const rtc::CopyOnWriteBuffer& buffer, 895 const rtc::CopyOnWriteBuffer& buffer,
896 ReceiveDataParams params, 896 ReceiveDataParams params,
897 int flags) { 897 int flags) {
898 RTC_DCHECK_RUN_ON(network_thread_); 898 RTC_DCHECK_RUN_ON(network_thread_);
899 LOG(LS_VERBOSE) << debug_name_ << "->OnInboundPacketFromSctpToChannel(...): " 899 LOG(LS_VERBOSE) << debug_name_ << "->OnInboundPacketFromSctpToChannel(...): "
900 << "Received SCTP data:" 900 << "Received SCTP data:"
901 << " sid=" << params.sid 901 << " sid=" << params.sid
902 << " notification: " << (flags & MSG_NOTIFICATION) 902 << " notification: " << (flags & MSG_NOTIFICATION)
903 << " length=" << buffer.size(); 903 << " length=" << buffer.size();
904 // Sending a packet with data == NULL (no data) is SCTPs "close the 904 // Sending a packet with data == null (no data) is SCTPs "close the
905 // connection" message. This sets sock_ = NULL; 905 // connection" message. This sets sock_ = null;
906 if (!buffer.size() || !buffer.data()) { 906 if (!buffer.size() || !buffer.data()) {
907 LOG(LS_INFO) << debug_name_ << "->OnInboundPacketFromSctpToChannel(...): " 907 LOG(LS_INFO) << debug_name_ << "->OnInboundPacketFromSctpToChannel(...): "
908 "No data, closing."; 908 "No data, closing.";
909 return; 909 return;
910 } 910 }
911 if (flags & MSG_NOTIFICATION) { 911 if (flags & MSG_NOTIFICATION) {
912 OnNotificationFromSctp(buffer); 912 OnNotificationFromSctp(buffer);
913 } else { 913 } else {
914 OnDataFromSctpToChannel(params, buffer); 914 OnDataFromSctpToChannel(params, buffer);
915 } 915 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 } 1082 }
1083 } 1083 }
1084 } 1084 }
1085 1085
1086 // Always try to send the queued RESET because this call indicates that the 1086 // Always try to send the queued RESET because this call indicates that the
1087 // last local RESET or remote RESET has made some progress. 1087 // last local RESET or remote RESET has made some progress.
1088 SendQueuedStreamResets(); 1088 SendQueuedStreamResets();
1089 } 1089 }
1090 1090
1091 } // namespace cricket 1091 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698