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/media/sctp/dcsctp_transport.cc b/media/sctp/dcsctp_transport.cc
index 15d1742..687e750 100644
--- a/media/sctp/dcsctp_transport.cc
+++ b/media/sctp/dcsctp_transport.cc
@@ -32,7 +32,6 @@
namespace {
enum class WebrtcPPID : dcsctp::PPID::UnderlyingType {
- kNone = 0, // No protocol is specified.
// https://www.rfc-editor.org/rfc/rfc8832.html#section-8.1
kDCEP = 50,
// https://www.rfc-editor.org/rfc/rfc8831.html#section-8
@@ -44,34 +43,29 @@
kBinaryEmpty = 57,
};
-WebrtcPPID ToPPID(cricket::DataMessageType message_type, size_t size) {
+WebrtcPPID ToPPID(DataMessageType message_type, size_t size) {
switch (message_type) {
- case cricket::DMT_CONTROL:
+ case webrtc::DataMessageType::kControl:
return WebrtcPPID::kDCEP;
- case cricket::DMT_TEXT:
+ case webrtc::DataMessageType::kText:
return size > 0 ? WebrtcPPID::kString : WebrtcPPID::kStringEmpty;
- case cricket::DMT_BINARY:
+ case webrtc::DataMessageType::kBinary:
return size > 0 ? WebrtcPPID::kBinary : WebrtcPPID::kBinaryEmpty;
- default:
- RTC_NOTREACHED();
}
- return WebrtcPPID::kNone;
}
-absl::optional<cricket::DataMessageType> ToDataMessageType(dcsctp::PPID ppid) {
+absl::optional<DataMessageType> ToDataMessageType(dcsctp::PPID ppid) {
switch (static_cast<WebrtcPPID>(ppid.value())) {
- case WebrtcPPID::kNone:
- return cricket::DMT_NONE;
case WebrtcPPID::kDCEP:
- return cricket::DMT_CONTROL;
+ return webrtc::DataMessageType::kControl;
case WebrtcPPID::kString:
case WebrtcPPID::kStringPartial:
case WebrtcPPID::kStringEmpty:
- return cricket::DMT_TEXT;
+ return webrtc::DataMessageType::kText;
case WebrtcPPID::kBinary:
case WebrtcPPID::kBinaryPartial:
case WebrtcPPID::kBinaryEmpty:
- return cricket::DMT_BINARY;
+ return webrtc::DataMessageType::kBinary;
}
return absl::nullopt;
}
@@ -177,13 +171,14 @@
return true;
}
-bool DcSctpTransport::SendData(const cricket::SendDataParams& params,
+bool DcSctpTransport::SendData(int sid,
+ const SendDataParams& params,
const rtc::CopyOnWriteBuffer& payload,
cricket::SendDataResult* result) {
RTC_DCHECK_RUN_ON(network_thread_);
- RTC_LOG(LS_VERBOSE) << debug_name_ << "->SendData(sid=" << params.sid
- << ", type=" << params.type
+ RTC_LOG(LS_VERBOSE) << debug_name_ << "->SendData(sid=" << sid
+ << ", type=" << static_cast<int>(params.type)
<< ", length=" << payload.size() << ").";
if (!socket_) {
@@ -216,7 +211,7 @@
}
dcsctp::DcSctpMessage message(
- dcsctp::StreamID(static_cast<uint16_t>(params.sid)),
+ dcsctp::StreamID(static_cast<uint16_t>(sid)),
dcsctp::PPID(static_cast<uint16_t>(ToPPID(params.type, payload.size()))),
std::move(message_payload));