OLD | NEW |
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 if (!connected_to_provider_) { | 290 if (!connected_to_provider_) { |
291 connected_to_provider_ = provider_->ConnectDataChannel(this); | 291 connected_to_provider_ = provider_->ConnectDataChannel(this); |
292 } | 292 } |
293 // The sid may have been unassigned when provider_->ConnectDataChannel was | 293 // The sid may have been unassigned when provider_->ConnectDataChannel was |
294 // done. So always add the streams even if connected_to_provider_ is true. | 294 // done. So always add the streams even if connected_to_provider_ is true. |
295 if (config_.id >= 0) { | 295 if (config_.id >= 0) { |
296 provider_->AddSctpDataStream(config_.id); | 296 provider_->AddSctpDataStream(config_.id); |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 // The underlying transport channel was destroyed. | |
301 // This function makes sure the DataChannel is disconnected and changes state to | |
302 // kClosed. | |
303 void DataChannel::OnTransportChannelDestroyed() { | 300 void DataChannel::OnTransportChannelDestroyed() { |
| 301 // This method needs to synchronously close the data channel, which means any |
| 302 // queued data needs to be discarded. |
| 303 queued_send_data_.Clear(); |
| 304 queued_control_data_.Clear(); |
304 DoClose(); | 305 DoClose(); |
305 } | 306 } |
306 | 307 |
307 void DataChannel::SetSendSsrc(uint32_t send_ssrc) { | 308 void DataChannel::SetSendSsrc(uint32_t send_ssrc) { |
308 ASSERT(data_channel_type_ == cricket::DCT_RTP); | 309 ASSERT(data_channel_type_ == cricket::DCT_RTP); |
309 if (send_ssrc_set_) { | 310 if (send_ssrc_set_) { |
310 return; | 311 return; |
311 } | 312 } |
312 send_ssrc_ = send_ssrc; | 313 send_ssrc_ = send_ssrc; |
313 send_ssrc_set_ = true; | 314 send_ssrc_set_ = true; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 QueueControlMessage(buffer); | 631 QueueControlMessage(buffer); |
631 } else { | 632 } else { |
632 LOG(LS_ERROR) << "Closing the DataChannel due to a failure to send" | 633 LOG(LS_ERROR) << "Closing the DataChannel due to a failure to send" |
633 << " the CONTROL message, send_result = " << send_result; | 634 << " the CONTROL message, send_result = " << send_result; |
634 Close(); | 635 Close(); |
635 } | 636 } |
636 return retval; | 637 return retval; |
637 } | 638 } |
638 | 639 |
639 } // namespace webrtc | 640 } // namespace webrtc |
OLD | NEW |