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

Unified Diff: webrtc/api/datachannel.cc

Issue 2614813003: Revert of Separating SCTP code from BaseChannel/MediaChannel. (Closed)
Patch Set: Also reverting https://codereview.webrtc.org/2612963002 Created 3 years, 11 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 | « webrtc/api/datachannel.h ('k') | webrtc/api/datachannel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/datachannel.cc
diff --git a/webrtc/api/datachannel.cc b/webrtc/api/datachannel.cc
index ad7cb571990be3649cddba387fb2f1dd62e77973..9812e9bb6a68cdddd50087329f0c49a82f9309e9 100644
--- a/webrtc/api/datachannel.cc
+++ b/webrtc/api/datachannel.cc
@@ -16,7 +16,7 @@
#include "webrtc/api/sctputils.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/refcount.h"
-#include "webrtc/media/sctp/sctptransportinternal.h"
+#include "webrtc/media/sctp/sctpdataengine.h"
namespace webrtc {
@@ -328,12 +328,12 @@ void DataChannel::OnMessage(rtc::Message* msg) {
}
}
-void DataChannel::OnDataReceived(const cricket::ReceiveDataParams& params,
+void DataChannel::OnDataReceived(cricket::DataChannel* channel,
+ const cricket::ReceiveDataParams& params,
const rtc::CopyOnWriteBuffer& payload) {
- if (data_channel_type_ == cricket::DCT_RTP && params.ssrc != receive_ssrc_) {
- return;
- }
- if (data_channel_type_ == cricket::DCT_SCTP && params.sid != config_.id) {
+ uint32_t expected_ssrc =
+ (data_channel_type_ == cricket::DCT_RTP) ? receive_ssrc_ : config_.id;
+ if (params.ssrc != expected_ssrc) {
return;
}
@@ -342,17 +342,17 @@ void DataChannel::OnDataReceived(const cricket::ReceiveDataParams& params,
if (handshake_state_ != kHandshakeWaitingForAck) {
// Ignore it if we are not expecting an ACK message.
LOG(LS_WARNING) << "DataChannel received unexpected CONTROL message, "
- << "sid = " << params.sid;
+ << "sid = " << params.ssrc;
return;
}
if (ParseDataChannelOpenAckMessage(payload)) {
// We can send unordered as soon as we receive the ACK message.
handshake_state_ = kHandshakeReady;
LOG(LS_INFO) << "DataChannel received OPEN_ACK message, sid = "
- << params.sid;
+ << params.ssrc;
} else {
LOG(LS_WARNING) << "DataChannel failed to parse OPEN_ACK message, sid = "
- << params.sid;
+ << params.ssrc;
}
return;
}
@@ -360,7 +360,7 @@ void DataChannel::OnDataReceived(const cricket::ReceiveDataParams& params,
ASSERT(params.type == cricket::DMT_BINARY ||
params.type == cricket::DMT_TEXT);
- LOG(LS_VERBOSE) << "DataChannel received DATA message, sid = " << params.sid;
+ LOG(LS_VERBOSE) << "DataChannel received DATA message, sid = " << params.ssrc;
// We can send unordered as soon as we receive any DATA message since the
// remote side must have received the OPEN (and old clients do not send
// OPEN_ACK).
@@ -390,8 +390,9 @@ void DataChannel::OnDataReceived(const cricket::ReceiveDataParams& params,
}
}
-void DataChannel::OnStreamClosedRemotely(int sid) {
- if (data_channel_type_ == cricket::DCT_SCTP && sid == config_.id) {
+void DataChannel::OnStreamClosedRemotely(uint32_t sid) {
+ if (data_channel_type_ == cricket::DCT_SCTP &&
+ sid == static_cast<uint32_t>(config_.id)) {
Close();
}
}
@@ -550,7 +551,7 @@ bool DataChannel::SendDataMessage(const DataBuffer& buffer,
send_params.max_rtx_count = config_.maxRetransmits;
send_params.max_rtx_ms = config_.maxRetransmitTime;
- send_params.sid = config_.id;
+ send_params.ssrc = config_.id;
} else {
send_params.ssrc = send_ssrc_;
}
@@ -622,7 +623,7 @@ bool DataChannel::SendControlMessage(const rtc::CopyOnWriteBuffer& buffer) {
(!is_open_message || !config_.negotiated));
cricket::SendDataParams send_params;
- send_params.sid = config_.id;
+ send_params.ssrc = config_.id;
// Send data as ordered before we receive any message from the remote peer to
// make sure the remote peer will not receive any data before it receives the
// OPEN message.
« no previous file with comments | « webrtc/api/datachannel.h ('k') | webrtc/api/datachannel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698