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

Side by Side Diff: webrtc/pc/datachannel.cc

Issue 2988153003: Replace CHECK(x && y) with two separate CHECK() calls (Closed)
Patch Set: fix mistakes Created 3 years, 4 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/p2p/client/basicportallocator.cc ('k') | webrtc/pc/remoteaudiosource.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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 receive_ssrc_set_ = true; 275 receive_ssrc_set_ = true;
276 UpdateState(); 276 UpdateState();
277 } 277 }
278 278
279 // The remote peer request that this channel shall be closed. 279 // The remote peer request that this channel shall be closed.
280 void DataChannel::RemotePeerRequestClose() { 280 void DataChannel::RemotePeerRequestClose() {
281 DoClose(); 281 DoClose();
282 } 282 }
283 283
284 void DataChannel::SetSctpSid(int sid) { 284 void DataChannel::SetSctpSid(int sid) {
285 RTC_DCHECK(config_.id < 0 && sid >= 0 && 285 RTC_DCHECK_LT(config_.id, 0);
286 data_channel_type_ == cricket::DCT_SCTP); 286 RTC_DCHECK_GE(sid, 0);
287 RTC_DCHECK_EQ(data_channel_type_, cricket::DCT_SCTP);
287 if (config_.id == sid) { 288 if (config_.id == sid) {
288 return; 289 return;
289 } 290 }
290 291
291 config_.id = sid; 292 config_.id = sid;
292 provider_->AddSctpDataStream(sid); 293 provider_->AddSctpDataStream(sid);
293 } 294 }
294 295
295 void DataChannel::OnTransportChannelCreated() { 296 void DataChannel::OnTransportChannelCreated() {
296 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP); 297 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP);
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 } 612 }
612 } 613 }
613 614
614 void DataChannel::QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer) { 615 void DataChannel::QueueControlMessage(const rtc::CopyOnWriteBuffer& buffer) {
615 queued_control_data_.Push(new DataBuffer(buffer, true)); 616 queued_control_data_.Push(new DataBuffer(buffer, true));
616 } 617 }
617 618
618 bool DataChannel::SendControlMessage(const rtc::CopyOnWriteBuffer& buffer) { 619 bool DataChannel::SendControlMessage(const rtc::CopyOnWriteBuffer& buffer) {
619 bool is_open_message = handshake_state_ == kHandshakeShouldSendOpen; 620 bool is_open_message = handshake_state_ == kHandshakeShouldSendOpen;
620 621
621 RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP && writable_ && 622 RTC_DCHECK_EQ(data_channel_type_, cricket::DCT_SCTP);
622 config_.id >= 0 && (!is_open_message || !config_.negotiated)); 623 RTC_DCHECK(writable_);
624 RTC_DCHECK_GE(config_.id, 0);
625 RTC_DCHECK(!is_open_message || !config_.negotiated);
623 626
624 cricket::SendDataParams send_params; 627 cricket::SendDataParams send_params;
625 send_params.sid = config_.id; 628 send_params.sid = config_.id;
626 // Send data as ordered before we receive any message from the remote peer to 629 // Send data as ordered before we receive any message from the remote peer to
627 // make sure the remote peer will not receive any data before it receives the 630 // make sure the remote peer will not receive any data before it receives the
628 // OPEN message. 631 // OPEN message.
629 send_params.ordered = config_.ordered || is_open_message; 632 send_params.ordered = config_.ordered || is_open_message;
630 send_params.type = cricket::DMT_CONTROL; 633 send_params.type = cricket::DMT_CONTROL;
631 634
632 cricket::SendDataResult send_result = cricket::SDR_SUCCESS; 635 cricket::SendDataResult send_result = cricket::SDR_SUCCESS;
(...skipping 10 matching lines...) Expand all
643 QueueControlMessage(buffer); 646 QueueControlMessage(buffer);
644 } else { 647 } else {
645 LOG(LS_ERROR) << "Closing the DataChannel due to a failure to send" 648 LOG(LS_ERROR) << "Closing the DataChannel due to a failure to send"
646 << " the CONTROL message, send_result = " << send_result; 649 << " the CONTROL message, send_result = " << send_result;
647 Close(); 650 Close();
648 } 651 }
649 return retval; 652 return retval;
650 } 653 }
651 654
652 } // namespace webrtc 655 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/p2p/client/basicportallocator.cc ('k') | webrtc/pc/remoteaudiosource.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698