| Index: talk/app/webrtc/datachannel.cc
|
| diff --git a/talk/app/webrtc/datachannel.cc b/talk/app/webrtc/datachannel.cc
|
| index 20cf7433555aa2262ff08f7cc41a0d6e43dc3f97..2028dc9f0317547c0358088cb98f5c3b4dcd095f 100644
|
| --- a/talk/app/webrtc/datachannel.cc
|
| +++ b/talk/app/webrtc/datachannel.cc
|
| @@ -31,7 +31,6 @@
|
|
|
| #include "talk/app/webrtc/mediastreamprovider.h"
|
| #include "talk/app/webrtc/sctputils.h"
|
| -#include "talk/media/sctp/sctpdataengine.h"
|
| #include "webrtc/base/logging.h"
|
| #include "webrtc/base/refcount.h"
|
|
|
| @@ -43,42 +42,6 @@
|
| enum {
|
| MSG_CHANNELREADY,
|
| };
|
| -
|
| -bool SctpSidAllocator::AllocateSid(rtc::SSLRole role, int* sid) {
|
| - int potential_sid = (role == rtc::SSL_CLIENT) ? 0 : 1;
|
| - while (!IsSidAvailable(potential_sid)) {
|
| - potential_sid += 2;
|
| - if (potential_sid > static_cast<int>(cricket::kMaxSctpSid)) {
|
| - return false;
|
| - }
|
| - }
|
| -
|
| - *sid = potential_sid;
|
| - used_sids_.insert(potential_sid);
|
| - return true;
|
| -}
|
| -
|
| -bool SctpSidAllocator::ReserveSid(int sid) {
|
| - if (!IsSidAvailable(sid)) {
|
| - return false;
|
| - }
|
| - used_sids_.insert(sid);
|
| - return true;
|
| -}
|
| -
|
| -void SctpSidAllocator::ReleaseSid(int sid) {
|
| - auto it = used_sids_.find(sid);
|
| - if (it != used_sids_.end()) {
|
| - used_sids_.erase(it);
|
| - }
|
| -}
|
| -
|
| -bool SctpSidAllocator::IsSidAvailable(int sid) const {
|
| - if (sid < 0 || sid > static_cast<int>(cricket::kMaxSctpSid)) {
|
| - return false;
|
| - }
|
| - return used_sids_.find(sid) == used_sids_.end();
|
| -}
|
|
|
| DataChannel::PacketQueue::PacketQueue() : byte_count_(0) {}
|
|
|
| @@ -294,9 +257,8 @@
|
|
|
| void DataChannel::SetSctpSid(int sid) {
|
| ASSERT(config_.id < 0 && sid >= 0 && data_channel_type_ == cricket::DCT_SCTP);
|
| - if (config_.id == sid) {
|
| - return;
|
| - }
|
| + if (config_.id == sid)
|
| + return;
|
|
|
| config_.id = sid;
|
| provider_->AddSctpDataStream(sid);
|
| @@ -314,13 +276,6 @@
|
| }
|
| }
|
|
|
| -// The underlying transport channel was destroyed.
|
| -// This function makes sure the DataChannel is disconnected and changes state to
|
| -// kClosed.
|
| -void DataChannel::OnTransportChannelDestroyed() {
|
| - DoClose();
|
| -}
|
| -
|
| void DataChannel::SetSendSsrc(uint32_t send_ssrc) {
|
| ASSERT(data_channel_type_ == cricket::DCT_RTP);
|
| if (send_ssrc_set_) {
|
| @@ -337,6 +292,13 @@
|
| OnChannelReady(true);
|
| break;
|
| }
|
| +}
|
| +
|
| +// The underlaying data engine is closing.
|
| +// This function makes sure the DataChannel is disconnected and changes state to
|
| +// kClosed.
|
| +void DataChannel::OnDataEngineClose() {
|
| + DoClose();
|
| }
|
|
|
| void DataChannel::OnDataReceived(cricket::DataChannel* channel,
|
| @@ -396,12 +358,6 @@
|
| return;
|
| }
|
| queued_received_data_.Push(buffer.release());
|
| - }
|
| -}
|
| -
|
| -void DataChannel::OnStreamClosedRemotely(uint32_t sid) {
|
| - if (data_channel_type_ == cricket::DCT_SCTP && sid == config_.id) {
|
| - Close();
|
| }
|
| }
|
|
|
| @@ -480,16 +436,12 @@
|
| }
|
|
|
| void DataChannel::SetState(DataState state) {
|
| - if (state_ == state) {
|
| - return;
|
| - }
|
| + if (state_ == state)
|
| + return;
|
|
|
| state_ = state;
|
| if (observer_) {
|
| observer_->OnStateChange();
|
| - }
|
| - if (state_ == kClosed) {
|
| - SignalClosed(this);
|
| }
|
| }
|
|
|
|
|