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

Unified Diff: talk/app/webrtc/datachannel.cc

Issue 1403633005: Revert of Moving MediaStreamSignaling logic into PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/datachannel.h ('k') | talk/app/webrtc/datachannel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « talk/app/webrtc/datachannel.h ('k') | talk/app/webrtc/datachannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698