datachannel: Merge SendDataParams and DMT types with webrtc equivalent
cricket::SendDataParams is replaced by webrtc::SendDataParams.
cricket::DataMessageType is replaced by webrtc::DataMessageType.
The sid member from cricket::SendDataParams is now passed as an argument
to functions that used one when necessary.
Bug: webrtc:7484
Change-Id: Ia4a89c9651fb54ab9a084a6098d49130b6319e1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/217761
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33966}
diff --git a/pc/sctp_data_channel.cc b/pc/sctp_data_channel.cc
index 2c90661..682d768 100644
--- a/pc/sctp_data_channel.cc
+++ b/pc/sctp_data_channel.cc
@@ -406,7 +406,7 @@
return;
}
- if (params.type == cricket::DMT_CONTROL) {
+ if (params.type == DataMessageType::kControl) {
if (handshake_state_ != kHandshakeWaitingForAck) {
// Ignore it if we are not expecting an ACK message.
RTC_LOG(LS_WARNING)
@@ -427,8 +427,8 @@
return;
}
- RTC_DCHECK(params.type == cricket::DMT_BINARY ||
- params.type == cricket::DMT_TEXT);
+ RTC_DCHECK(params.type == DataMessageType::kBinary ||
+ params.type == DataMessageType::kText);
RTC_LOG(LS_VERBOSE) << "DataChannel received DATA message, sid = "
<< params.sid;
@@ -439,7 +439,7 @@
handshake_state_ = kHandshakeReady;
}
- bool binary = (params.type == cricket::DMT_BINARY);
+ bool binary = (params.type == webrtc::DataMessageType::kBinary);
auto buffer = std::make_unique<DataBuffer>(payload, binary);
if (state_ == kOpen && observer_) {
++messages_received_;
@@ -620,7 +620,7 @@
bool SctpDataChannel::SendDataMessage(const DataBuffer& buffer,
bool queue_if_blocked) {
RTC_DCHECK_RUN_ON(signaling_thread_);
- cricket::SendDataParams send_params;
+ SendDataParams send_params;
send_params.ordered = config_.ordered;
// Send as ordered if it is still going through OPEN/ACK signaling.
@@ -633,11 +633,12 @@
send_params.max_rtx_count = config_.maxRetransmits;
send_params.max_rtx_ms = config_.maxRetransmitTime;
- send_params.sid = config_.id;
- send_params.type = buffer.binary ? cricket::DMT_BINARY : cricket::DMT_TEXT;
+ send_params.type =
+ buffer.binary ? DataMessageType::kBinary : DataMessageType::kText;
cricket::SendDataResult send_result = cricket::SDR_SUCCESS;
- bool success = provider_->SendData(send_params, buffer.data, &send_result);
+ bool success =
+ provider_->SendData(config_.id, send_params, buffer.data, &send_result);
if (success) {
++messages_sent_;
@@ -703,16 +704,16 @@
bool is_open_message = handshake_state_ == kHandshakeShouldSendOpen;
RTC_DCHECK(!is_open_message || !config_.negotiated);
- cricket::SendDataParams send_params;
- send_params.sid = config_.id;
+ SendDataParams send_params;
// 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.
send_params.ordered = config_.ordered || is_open_message;
- send_params.type = cricket::DMT_CONTROL;
+ send_params.type = DataMessageType::kControl;
cricket::SendDataResult send_result = cricket::SDR_SUCCESS;
- bool retval = provider_->SendData(send_params, buffer, &send_result);
+ bool retval =
+ provider_->SendData(config_.id, send_params, buffer, &send_result);
if (retval) {
RTC_LOG(LS_VERBOSE) << "Sent CONTROL message on channel " << config_.id;