rtc::Buffer: Rename length to size, for conformance with the STL
And add a constructor for creating an uninitialized Buffer of a
specified size.
(I intend to follow up with more Buffer changes, but since it's rather
widely used, the rename is quite noisy and works better as a separate
CL.)
R=tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/48579004
Cr-Commit-Position: refs/heads/master@{#8841}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8841 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/app/webrtc/datachannel.cc b/talk/app/webrtc/datachannel.cc
index 05c934c..1897b73 100644
--- a/talk/app/webrtc/datachannel.cc
+++ b/talk/app/webrtc/datachannel.cc
@@ -330,8 +330,8 @@
if (was_ever_writable_ && observer_) {
observer_->OnMessage(*buffer.get());
} else {
- if (queued_received_data_.byte_count() + payload.length() >
- kMaxQueuedReceivedDataBytes) {
+ if (queued_received_data_.byte_count() + payload.size() >
+ kMaxQueuedReceivedDataBytes) {
LOG(LS_ERROR) << "Queued received data exceeds the max buffer size.";
queued_received_data_.Clear();
diff --git a/talk/app/webrtc/datachannel_unittest.cc b/talk/app/webrtc/datachannel_unittest.cc
index 6a73fbc..ab5dbe9 100644
--- a/talk/app/webrtc/datachannel_unittest.cc
+++ b/talk/app/webrtc/datachannel_unittest.cc
@@ -145,7 +145,7 @@
for (int i = 0; i < number_of_packets; ++i) {
EXPECT_TRUE(webrtc_data_channel_->Send(buffer));
}
- EXPECT_EQ(buffer.data.length() * number_of_packets,
+ EXPECT_EQ(buffer.data.size() * number_of_packets,
webrtc_data_channel_->buffered_amount());
}
@@ -359,10 +359,8 @@
TEST_F(SctpDataChannelTest, ClosedWhenSendBufferFull) {
SetChannelReady();
- const size_t buffer_size = 1024;
- rtc::Buffer buffer;
- buffer.SetLength(buffer_size);
- memset(buffer.data(), 0, buffer_size);
+ rtc::Buffer buffer(1024);
+ memset(buffer.data(), 0, buffer.size());
webrtc::DataBuffer packet(buffer, true);
provider_.set_send_blocked(true);
@@ -413,10 +411,8 @@
// Tests that the DataChannel is closed if the received buffer is full.
TEST_F(SctpDataChannelTest, ClosedWhenReceivedBufferFull) {
SetChannelReady();
- const size_t buffer_size = 1024;
- rtc::Buffer buffer;
- buffer.SetLength(buffer_size);
- memset(buffer.data(), 0, buffer_size);
+ rtc::Buffer buffer(1024);
+ memset(buffer.data(), 0, buffer.size());
cricket::ReceiveDataParams params;
params.ssrc = 0;
diff --git a/talk/app/webrtc/datachannelinterface.h b/talk/app/webrtc/datachannelinterface.h
index ed113fc..6312262 100644
--- a/talk/app/webrtc/datachannelinterface.h
+++ b/talk/app/webrtc/datachannelinterface.h
@@ -76,7 +76,7 @@
: data(text.data(), text.length()),
binary(false) {
}
- size_t size() const { return data.length(); }
+ size_t size() const { return data.size(); }
rtc::Buffer data;
// Indicates if the received data contains UTF-8 or binary data.
diff --git a/talk/app/webrtc/java/jni/peerconnection_jni.cc b/talk/app/webrtc/java/jni/peerconnection_jni.cc
index 7b4228b..7e6072c 100644
--- a/talk/app/webrtc/java/jni/peerconnection_jni.cc
+++ b/talk/app/webrtc/java/jni/peerconnection_jni.cc
@@ -581,9 +581,8 @@
void OnMessage(const DataBuffer& buffer) override {
ScopedLocalRefFrame local_ref_frame(jni());
- jobject byte_buffer =
- jni()->NewDirectByteBuffer(const_cast<char*>(buffer.data.data()),
- buffer.data.length());
+ jobject byte_buffer = jni()->NewDirectByteBuffer(
+ const_cast<char*>(buffer.data.data()), buffer.data.size());
jobject j_buffer = jni()->NewObject(*j_buffer_class_, j_buffer_ctor_,
byte_buffer, buffer.binary);
jni()->CallVoidMethod(*j_observer_global_, j_on_message_mid_, j_buffer);
diff --git a/talk/app/webrtc/objc/RTCDataChannel.mm b/talk/app/webrtc/objc/RTCDataChannel.mm
index 07b90d9..a419577 100644
--- a/talk/app/webrtc/objc/RTCDataChannel.mm
+++ b/talk/app/webrtc/objc/RTCDataChannel.mm
@@ -149,7 +149,7 @@
- (NSData*)data {
return [NSData dataWithBytes:_dataBuffer->data.data()
- length:_dataBuffer->data.length()];
+ length:_dataBuffer->data.size()];
}
- (BOOL)isBinary {
diff --git a/talk/app/webrtc/sctputils.cc b/talk/app/webrtc/sctputils.cc
index 988f468..8aa902f 100644
--- a/talk/app/webrtc/sctputils.cc
+++ b/talk/app/webrtc/sctputils.cc
@@ -54,7 +54,7 @@
// Format defined at
// http://tools.ietf.org/html/draft-jesup-rtcweb-data-protocol-04
- rtc::ByteBuffer buffer(payload.data(), payload.length());
+ rtc::ByteBuffer buffer(payload.data(), payload.size());
uint8 message_type;
if (!buffer.ReadUInt8(&message_type)) {
@@ -126,7 +126,7 @@
}
bool ParseDataChannelOpenAckMessage(const rtc::Buffer& payload) {
- rtc::ByteBuffer buffer(payload.data(), payload.length());
+ rtc::ByteBuffer buffer(payload.data(), payload.size());
uint8 message_type;
if (!buffer.ReadUInt8(&message_type)) {
diff --git a/talk/app/webrtc/statscollector.cc b/talk/app/webrtc/statscollector.cc
index ef43ff1..f76245d 100644
--- a/talk/app/webrtc/statscollector.cc
+++ b/talk/app/webrtc/statscollector.cc
@@ -538,8 +538,8 @@
rtc::Buffer der_buffer;
cert->ToDER(&der_buffer);
std::string der_base64;
- rtc::Base64::EncodeFromArray(
- der_buffer.data(), der_buffer.length(), &der_base64);
+ rtc::Base64::EncodeFromArray(der_buffer.data(), der_buffer.size(),
+ &der_base64);
StatsReport::Id id(StatsReport::NewTypedId(
StatsReport::kStatsReportTypeCertificate, fingerprint));
diff --git a/talk/app/webrtc/test/fakedatachannelprovider.h b/talk/app/webrtc/test/fakedatachannelprovider.h
index 41d6737..bf64a94 100644
--- a/talk/app/webrtc/test/fakedatachannelprovider.h
+++ b/talk/app/webrtc/test/fakedatachannelprovider.h
@@ -45,7 +45,7 @@
return false;
}
- if (transport_error_ || payload.length() == 0) {
+ if (transport_error_ || payload.size() == 0) {
*result = cricket::SDR_ERROR;
return false;
}
diff --git a/talk/app/webrtc/test/mockpeerconnectionobservers.h b/talk/app/webrtc/test/mockpeerconnectionobservers.h
index c32c82c..40e9001 100644
--- a/talk/app/webrtc/test/mockpeerconnectionobservers.h
+++ b/talk/app/webrtc/test/mockpeerconnectionobservers.h
@@ -100,7 +100,7 @@
virtual void OnStateChange() { state_ = channel_->state(); }
virtual void OnMessage(const DataBuffer& buffer) {
- last_message_.assign(buffer.data.data(), buffer.data.length());
+ last_message_.assign(buffer.data.data(), buffer.data.size());
++received_message_count_;
}
diff --git a/talk/media/base/fakemediaengine.h b/talk/media/base/fakemediaengine.h
index c7b52c4..4789047 100644
--- a/talk/media/base/fakemediaengine.h
+++ b/talk/media/base/fakemediaengine.h
@@ -193,11 +193,11 @@
void set_playout(bool playout) { playout_ = playout; }
virtual void OnPacketReceived(rtc::Buffer* packet,
const rtc::PacketTime& packet_time) {
- rtp_packets_.push_back(std::string(packet->data(), packet->length()));
+ rtp_packets_.push_back(std::string(packet->data(), packet->size()));
}
virtual void OnRtcpReceived(rtc::Buffer* packet,
const rtc::PacketTime& packet_time) {
- rtcp_packets_.push_back(std::string(packet->data(), packet->length()));
+ rtcp_packets_.push_back(std::string(packet->data(), packet->size()));
}
virtual void OnReadyToSend(bool ready) {
ready_to_send_ = ready;
@@ -686,7 +686,7 @@
return false;
} else {
last_sent_data_params_ = params;
- last_sent_data_ = std::string(payload.data(), payload.length());
+ last_sent_data_ = std::string(payload.data(), payload.size());
return true;
}
}
diff --git a/talk/media/base/fakenetworkinterface.h b/talk/media/base/fakenetworkinterface.h
index 3a9d135..424101e 100644
--- a/talk/media/base/fakenetworkinterface.h
+++ b/talk/media/base/fakenetworkinterface.h
@@ -71,7 +71,7 @@
rtc::CritScope cs(&crit_);
int bytes = 0;
for (size_t i = 0; i < rtp_packets_.size(); ++i) {
- bytes += static_cast<int>(rtp_packets_[i].length());
+ bytes += static_cast<int>(rtp_packets_[i].size());
}
return bytes;
}
@@ -138,7 +138,7 @@
rtc::CritScope cs(&crit_);
uint32 cur_ssrc = 0;
- if (!GetRtpSsrc(packet->data(), packet->length(), &cur_ssrc)) {
+ if (!GetRtpSsrc(packet->data(), packet->size(), &cur_ssrc)) {
return false;
}
sent_ssrcs_[cur_ssrc]++;
@@ -156,7 +156,7 @@
if (conf_) {
rtc::Buffer buffer_copy(*packet);
for (size_t i = 0; i < conf_sent_ssrcs_.size(); ++i) {
- if (!SetRtpSsrc(buffer_copy.data(), buffer_copy.length(),
+ if (!SetRtpSsrc(buffer_copy.data(), buffer_copy.size(),
conf_sent_ssrcs_[i])) {
return false;
}
@@ -221,13 +221,13 @@
}
uint32 cur_ssrc = 0;
for (size_t i = 0; i < rtp_packets_.size(); ++i) {
- if (!GetRtpSsrc(rtp_packets_[i].data(),
- rtp_packets_[i].length(), &cur_ssrc)) {
+ if (!GetRtpSsrc(rtp_packets_[i].data(), rtp_packets_[i].size(),
+ &cur_ssrc)) {
return;
}
if (ssrc == cur_ssrc) {
if (bytes) {
- *bytes += static_cast<int>(rtp_packets_[i].length());
+ *bytes += static_cast<int>(rtp_packets_[i].size());
}
if (packets) {
++(*packets);
diff --git a/talk/media/base/filemediaengine.cc b/talk/media/base/filemediaengine.cc
index 4a840d9..1c26568 100644
--- a/talk/media/base/filemediaengine.cc
+++ b/talk/media/base/filemediaengine.cc
@@ -230,7 +230,7 @@
void RtpSenderReceiver::OnPacketReceived(rtc::Buffer* packet) {
if (rtp_dump_writer_) {
- rtp_dump_writer_->WriteRtpPacket(packet->data(), packet->length());
+ rtp_dump_writer_->WriteRtpPacket(packet->data(), packet->size());
}
}
diff --git a/talk/media/base/filemediaengine_unittest.cc b/talk/media/base/filemediaengine_unittest.cc
index 8c2f9bf..43c2c84 100644
--- a/talk/media/base/filemediaengine_unittest.cc
+++ b/talk/media/base/filemediaengine_unittest.cc
@@ -66,8 +66,8 @@
media_channel_->OnPacketReceived(packet, rtc::PacketTime());
}
if (dump_writer_.get() &&
- rtc::SR_SUCCESS != dump_writer_->WriteRtpPacket(
- packet->data(), packet->length())) {
+ rtc::SR_SUCCESS !=
+ dump_writer_->WriteRtpPacket(packet->data(), packet->size())) {
return false;
}
diff --git a/talk/media/base/rtpdataengine.cc b/talk/media/base/rtpdataengine.cc
index d60da6f..923b254 100644
--- a/talk/media/base/rtpdataengine.cc
+++ b/talk/media/base/rtpdataengine.cc
@@ -216,7 +216,7 @@
void RtpDataMediaChannel::OnPacketReceived(
rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
RtpHeader header;
- if (!GetRtpHeader(packet->data(), packet->length(), &header)) {
+ if (!GetRtpHeader(packet->data(), packet->size(), &header)) {
// Don't want to log for every corrupt packet.
// LOG(LS_WARNING) << "Could not read rtp header from packet of length "
// << packet->length() << ".";
@@ -224,7 +224,7 @@
}
size_t header_length;
- if (!GetRtpHeaderLen(packet->data(), packet->length(), &header_length)) {
+ if (!GetRtpHeaderLen(packet->data(), packet->size(), &header_length)) {
// Don't want to log for every corrupt packet.
// LOG(LS_WARNING) << "Could not read rtp header"
// << length from packet of length "
@@ -232,7 +232,7 @@
return;
}
const char* data = packet->data() + header_length + sizeof(kReservedSpace);
- size_t data_len = packet->length() - header_length - sizeof(kReservedSpace);
+ size_t data_len = packet->size() - header_length - sizeof(kReservedSpace);
if (!receiving_) {
LOG(LS_WARNING) << "Not receiving packet "
@@ -292,7 +292,7 @@
}
if (!sending_) {
LOG(LS_WARNING) << "Not sending packet with ssrc=" << params.ssrc
- << " len=" << payload.length() << " before SetSend(true).";
+ << " len=" << payload.size() << " before SetSend(true).";
return false;
}
@@ -316,8 +316,8 @@
return false;
}
- size_t packet_len = (kMinRtpPacketLen + sizeof(kReservedSpace)
- + payload.length() + kMaxSrtpHmacOverhead);
+ size_t packet_len = (kMinRtpPacketLen + sizeof(kReservedSpace) +
+ payload.size() + kMaxSrtpHmacOverhead);
if (packet_len > kDataMaxRtpPacketLen) {
return false;
}
@@ -339,19 +339,18 @@
rtc::Buffer packet;
packet.SetCapacity(packet_len);
- packet.SetLength(kMinRtpPacketLen);
- if (!SetRtpHeader(packet.data(), packet.length(), header)) {
+ packet.SetSize(kMinRtpPacketLen);
+ if (!SetRtpHeader(packet.data(), packet.size(), header)) {
return false;
}
packet.AppendData(&kReservedSpace, sizeof(kReservedSpace));
- packet.AppendData(payload.data(), payload.length());
+ packet.AppendData(payload.data(), payload.size());
LOG(LS_VERBOSE) << "Sent RTP data packet: "
- << " stream=" << found_stream->id
- << " ssrc=" << header.ssrc
+ << " stream=" << found_stream->id << " ssrc=" << header.ssrc
<< ", seqnum=" << header.seq_num
<< ", timestamp=" << header.timestamp
- << ", len=" << payload.length();
+ << ", len=" << payload.size();
MediaChannel::SendPacket(&packet);
send_limiter_->Use(packet_len, now);
diff --git a/talk/media/base/rtpdataengine_unittest.cc b/talk/media/base/rtpdataengine_unittest.cc
index 884fab4..0cd1b2a 100644
--- a/talk/media/base/rtpdataengine_unittest.cc
+++ b/talk/media/base/rtpdataengine_unittest.cc
@@ -143,8 +143,8 @@
// Assume RTP header of length 12
rtc::scoped_ptr<const rtc::Buffer> packet(
iface_->GetRtpPacket(index));
- if (packet->length() > 12) {
- return std::string(packet->data() + 12, packet->length() - 12);
+ if (packet->size() > 12) {
+ return std::string(packet->data() + 12, packet->size() - 12);
} else {
return "";
}
@@ -154,7 +154,7 @@
rtc::scoped_ptr<const rtc::Buffer> packet(
iface_->GetRtpPacket(index));
cricket::RtpHeader header;
- GetRtpHeader(packet->data(), packet->length(), &header);
+ GetRtpHeader(packet->data(), packet->size(), &header);
return header;
}
diff --git a/talk/media/base/videoengine_unittest.h b/talk/media/base/videoengine_unittest.h
index 7b5dc85..1c759f4 100644
--- a/talk/media/base/videoengine_unittest.h
+++ b/talk/media/base/videoengine_unittest.h
@@ -670,7 +670,7 @@
static bool ParseRtpPacket(const rtc::Buffer* p, bool* x, int* pt,
int* seqnum, uint32* tstamp, uint32* ssrc,
std::string* payload) {
- rtc::ByteBuffer buf(p->data(), p->length());
+ rtc::ByteBuffer buf(p->data(), p->size());
uint8 u08 = 0;
uint16 u16 = 0;
uint32 u32 = 0;
@@ -730,10 +730,10 @@
int count = 0;
for (int i = start_index; i < stop_index; ++i) {
rtc::scoped_ptr<const rtc::Buffer> p(GetRtcpPacket(i));
- rtc::ByteBuffer buf(p->data(), p->length());
+ rtc::ByteBuffer buf(p->data(), p->size());
size_t total_len = 0;
// The packet may be a compound RTCP packet.
- while (total_len < p->length()) {
+ while (total_len < p->size()) {
// Read FMT, type and length.
uint8 fmt = 0;
uint8 type = 0;
diff --git a/talk/media/sctp/sctpdataengine.cc b/talk/media/sctp/sctpdataengine.cc
index 95f71a7..d801035 100644
--- a/talk/media/sctp/sctpdataengine.cc
+++ b/talk/media/sctp/sctpdataengine.cc
@@ -524,7 +524,7 @@
if (!sending_) {
LOG(LS_WARNING) << debug_name_ << "->SendData(...): "
<< "Not sending packet with ssrc=" << params.ssrc
- << " len=" << payload.length() << " before SetSend(true).";
+ << " len=" << payload.size() << " before SetSend(true).";
return false;
}
@@ -560,11 +560,9 @@
}
// We don't fragment.
- send_res = usrsctp_sendv(sock_, payload.data(),
- static_cast<size_t>(payload.length()),
- NULL, 0, &spa,
- rtc::checked_cast<socklen_t>(sizeof(spa)),
- SCTP_SENDV_SPA, 0);
+ send_res = usrsctp_sendv(
+ sock_, payload.data(), static_cast<size_t>(payload.size()), NULL, 0, &spa,
+ rtc::checked_cast<socklen_t>(sizeof(spa)), SCTP_SENDV_SPA, 0);
if (send_res < 0) {
if (errno == SCTP_EWOULDBLOCK) {
*result = SDR_BLOCK;
@@ -586,8 +584,8 @@
// Called by network interface when a packet has been received.
void SctpDataMediaChannel::OnPacketReceived(
rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
- LOG(LS_VERBOSE) << debug_name_ << "->OnPacketReceived(...): " << " length="
- << packet->length() << ", sending: " << sending_;
+ LOG(LS_VERBOSE) << debug_name_ << "->OnPacketReceived(...): "
+ << " length=" << packet->size() << ", sending: " << sending_;
// Only give receiving packets to usrsctp after if connected. This enables two
// peers to each make a connect call, but for them not to receive an INIT
// packet before they have called connect; least the last receiver of the INIT
@@ -596,7 +594,7 @@
// Pass received packet to SCTP stack. Once processed by usrsctp, the data
// will be will be given to the global OnSctpInboundData, and then,
// marshalled by a Post and handled with OnMessage.
- usrsctp_conninput(this, packet->data(), packet->length(), 0);
+ usrsctp_conninput(this, packet->data(), packet->size(), 0);
} else {
// TODO(ldixon): Consider caching the packet for very slightly better
// reliability.
@@ -609,10 +607,10 @@
<< "Received SCTP data:"
<< " ssrc=" << packet->params.ssrc
<< " notification: " << (packet->flags & MSG_NOTIFICATION)
- << " length=" << packet->buffer.length();
+ << " length=" << packet->buffer.size();
// Sending a packet with data == NULL (no data) is SCTPs "close the
// connection" message. This sets sock_ = NULL;
- if (!packet->buffer.length() || !packet->buffer.data()) {
+ if (!packet->buffer.size() || !packet->buffer.data()) {
LOG(LS_INFO) << debug_name_ << "->OnInboundPacketFromSctpToChannel(...): "
"No data, closing.";
return;
@@ -628,16 +626,15 @@
const ReceiveDataParams& params, rtc::Buffer* buffer) {
if (receiving_) {
LOG(LS_VERBOSE) << debug_name_ << "->OnDataFromSctpToChannel(...): "
- << "Posting with length: " << buffer->length()
+ << "Posting with length: " << buffer->size()
<< " on stream " << params.ssrc;
// Reports all received messages to upper layers, no matter whether the sid
// is known.
- SignalDataReceived(params, buffer->data(), buffer->length());
+ SignalDataReceived(params, buffer->data(), buffer->size());
} else {
LOG(LS_WARNING) << debug_name_ << "->OnDataFromSctpToChannel(...): "
<< "Not receiving packet with sid=" << params.ssrc
- << " len=" << buffer->length()
- << " before SetReceive(true).";
+ << " len=" << buffer->size() << " before SetReceive(true).";
}
}
@@ -697,7 +694,7 @@
void SctpDataMediaChannel::OnNotificationFromSctp(rtc::Buffer* buffer) {
const sctp_notification& notification =
reinterpret_cast<const sctp_notification&>(*buffer->data());
- ASSERT(notification.sn_header.sn_length == buffer->length());
+ ASSERT(notification.sn_header.sn_length == buffer->size());
// TODO(ldixon): handle notifications appropriately.
switch (notification.sn_header.sn_type) {
@@ -891,7 +888,7 @@
void SctpDataMediaChannel::OnPacketFromSctpToNetwork(
rtc::Buffer* buffer) {
- if (buffer->length() > kSctpMtu) {
+ if (buffer->size() > kSctpMtu) {
LOG(LS_ERROR) << debug_name_ << "->OnPacketFromSctpToNetwork(...): "
<< "SCTP seems to have made a packet that is bigger "
"than its official MTU.";
diff --git a/talk/media/sctp/sctpdataengine_unittest.cc b/talk/media/sctp/sctpdataengine_unittest.cc
index 3a050cc..5b4c09e 100644
--- a/talk/media/sctp/sctpdataengine_unittest.cc
+++ b/talk/media/sctp/sctpdataengine_unittest.cc
@@ -74,7 +74,7 @@
// TODO(ldixon): Can/should we use Buffer.TransferTo here?
// Note: this assignment does a deep copy of data from packet.
- rtc::Buffer* buffer = new rtc::Buffer(packet->data(), packet->length());
+ rtc::Buffer* buffer = new rtc::Buffer(packet->data(), packet->size());
thread_->Post(this, MSG_PACKET, rtc::WrapMessageData(buffer));
LOG(LS_VERBOSE) << "SctpFakeNetworkInterface::SendPacket, Posted message.";
return true;
diff --git a/talk/media/webrtc/webrtcvideoengine.cc b/talk/media/webrtc/webrtcvideoengine.cc
index 93ca4c6..4bb9bbe 100644
--- a/talk/media/webrtc/webrtcvideoengine.cc
+++ b/talk/media/webrtc/webrtcvideoengine.cc
@@ -2849,7 +2849,7 @@
// any multiplexed streams, just send it to the default channel. Otherwise,
// send it to the specific decoder instance for that stream.
uint32 ssrc = 0;
- if (!GetRtpSsrc(packet->data(), packet->length(), &ssrc))
+ if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc))
return;
int processing_channel_id = GetRecvChannelId(ssrc);
if (processing_channel_id == kChannelIdUnset) {
@@ -2865,9 +2865,7 @@
}
engine()->vie()->network()->ReceivedRTPPacket(
- processing_channel_id,
- packet->data(),
- packet->length(),
+ processing_channel_id, packet->data(), packet->size(),
webrtc::PacketTime(packet_time.timestamp, packet_time.not_before));
}
@@ -2879,12 +2877,12 @@
// correct receiver reports.
uint32 ssrc = 0;
- if (!GetRtcpSsrc(packet->data(), packet->length(), &ssrc)) {
+ if (!GetRtcpSsrc(packet->data(), packet->size(), &ssrc)) {
LOG(LS_WARNING) << "Failed to parse SSRC from received RTCP packet";
return;
}
int type = 0;
- if (!GetRtcpType(packet->data(), packet->length(), &type)) {
+ if (!GetRtcpType(packet->data(), packet->size(), &type)) {
LOG(LS_WARNING) << "Failed to parse type from received RTCP packet";
return;
}
@@ -2894,9 +2892,7 @@
int recv_channel_id = GetRecvChannelId(ssrc);
if (recv_channel_id != kChannelIdUnset && !IsDefaultChannelId(recv_channel_id)) {
engine_->vie()->network()->ReceivedRTCPPacket(
- recv_channel_id,
- packet->data(),
- packet->length());
+ recv_channel_id, packet->data(), packet->size());
}
}
// SR may continue RR and any RR entry may correspond to any one of the send
@@ -2906,10 +2902,8 @@
iter != send_channels_.end(); ++iter) {
WebRtcVideoChannelSendInfo* send_channel = iter->second;
int channel_id = send_channel->channel_id();
- engine_->vie()->network()->ReceivedRTCPPacket(
- channel_id,
- packet->data(),
- packet->length());
+ engine_->vie()->network()->ReceivedRTCPPacket(channel_id, packet->data(),
+ packet->size());
}
}
diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc
index 4410e59..496c439 100644
--- a/talk/media/webrtc/webrtcvideoengine2.cc
+++ b/talk/media/webrtc/webrtcvideoengine2.cc
@@ -1105,7 +1105,7 @@
const rtc::PacketTime& packet_time) {
const webrtc::PacketReceiver::DeliveryStatus delivery_result =
call_->Receiver()->DeliverPacket(
- reinterpret_cast<const uint8_t*>(packet->data()), packet->length());
+ reinterpret_cast<const uint8_t*>(packet->data()), packet->size());
switch (delivery_result) {
case webrtc::PacketReceiver::DELIVERY_OK:
return;
@@ -1116,7 +1116,7 @@
}
uint32 ssrc = 0;
- if (!GetRtpSsrc(packet->data(), packet->length(), &ssrc)) {
+ if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) {
return;
}
@@ -1131,7 +1131,7 @@
}
if (call_->Receiver()->DeliverPacket(
- reinterpret_cast<const uint8_t*>(packet->data()), packet->length()) !=
+ reinterpret_cast<const uint8_t*>(packet->data()), packet->size()) !=
webrtc::PacketReceiver::DELIVERY_OK) {
LOG(LS_WARNING) << "Failed to deliver RTP packet on re-delivery.";
return;
@@ -1142,7 +1142,7 @@
rtc::Buffer* packet,
const rtc::PacketTime& packet_time) {
if (call_->Receiver()->DeliverPacket(
- reinterpret_cast<const uint8_t*>(packet->data()), packet->length()) !=
+ reinterpret_cast<const uint8_t*>(packet->data()), packet->size()) !=
webrtc::PacketReceiver::DELIVERY_OK) {
LOG(LS_WARNING) << "Failed to deliver RTCP packet.";
}
diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc
index 282c033..099a55b 100644
--- a/talk/media/webrtc/webrtcvoiceengine.cc
+++ b/talk/media/webrtc/webrtcvoiceengine.cc
@@ -3107,8 +3107,8 @@
// Pick which channel to send this packet to. If this packet doesn't match
// any multiplexed streams, just send it to the default channel. Otherwise,
// send it to the specific decoder instance for that stream.
- int which_channel = GetReceiveChannelNum(
- ParseSsrc(packet->data(), packet->length(), false));
+ int which_channel =
+ GetReceiveChannelNum(ParseSsrc(packet->data(), packet->size(), false));
if (which_channel == -1) {
which_channel = voe_channel();
}
@@ -3131,9 +3131,7 @@
// Pass it off to the decoder.
engine()->voe()->network()->ReceivedRTPPacket(
- which_channel,
- packet->data(),
- packet->length(),
+ which_channel, packet->data(), packet->size(),
webrtc::PacketTime(packet_time.timestamp, packet_time.not_before));
}
@@ -3144,7 +3142,7 @@
// Receiving channels need sender reports in order to create
// correct receiver reports.
int type = 0;
- if (!GetRtcpType(packet->data(), packet->length(), &type)) {
+ if (!GetRtcpType(packet->data(), packet->size(), &type)) {
LOG(LS_WARNING) << "Failed to parse type from received RTCP packet";
return;
}
@@ -3152,13 +3150,11 @@
// If it is a sender report, find the channel that is listening.
bool has_sent_to_default_channel = false;
if (type == kRtcpTypeSR) {
- int which_channel = GetReceiveChannelNum(
- ParseSsrc(packet->data(), packet->length(), true));
+ int which_channel =
+ GetReceiveChannelNum(ParseSsrc(packet->data(), packet->size(), true));
if (which_channel != -1) {
engine()->voe()->network()->ReceivedRTCPPacket(
- which_channel,
- packet->data(),
- packet->length());
+ which_channel, packet->data(), packet->size());
if (IsDefaultChannel(which_channel))
has_sent_to_default_channel = true;
@@ -3176,9 +3172,7 @@
continue;
engine()->voe()->network()->ReceivedRTCPPacket(
- iter->second->channel(),
- packet->data(),
- packet->length());
+ iter->second->channel(), packet->data(), packet->size());
}
}
diff --git a/talk/session/media/channel.cc b/talk/session/media/channel.cc
index eb06aef3..0750537 100644
--- a/talk/session/media/channel.cc
+++ b/talk/session/media/channel.cc
@@ -131,8 +131,8 @@
static bool ValidPacket(bool rtcp, const rtc::Buffer* packet) {
// Check the packet size. We could check the header too if needed.
return (packet &&
- packet->length() >= (!rtcp ? kMinRtpPacketLen : kMinRtcpPacketLen) &&
- packet->length() <= kMaxRtpPacketLen);
+ packet->size() >= (!rtcp ? kMinRtpPacketLen : kMinRtcpPacketLen) &&
+ packet->size() <= kMaxRtpPacketLen);
}
static bool IsReceiveContentDirection(MediaContentDirection direction) {
@@ -497,15 +497,15 @@
// Protect ourselves against crazy data.
if (!ValidPacket(rtcp, packet)) {
LOG(LS_ERROR) << "Dropping outgoing " << content_name_ << " "
- << PacketType(rtcp) << " packet: wrong size="
- << packet->length();
+ << PacketType(rtcp)
+ << " packet: wrong size=" << packet->size();
return false;
}
// Signal to the media sink before protecting the packet.
{
rtc::CritScope cs(&signal_send_packet_cs_);
- SignalSendPacketPreCrypto(packet->data(), packet->length(), rtcp);
+ SignalSendPacketPreCrypto(packet->data(), packet->size(), rtcp);
}
rtc::PacketOptions options(dscp);
@@ -513,7 +513,7 @@
if (srtp_filter_.IsActive()) {
bool res;
char* data = packet->data();
- int len = static_cast<int>(packet->length());
+ int len = static_cast<int>(packet->size());
if (!rtcp) {
// If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done
// inside libsrtp for a RTP packet. A external HMAC module will be writing
@@ -566,7 +566,7 @@
}
// Update the length of the packet now that we've added the auth tag.
- packet->SetLength(len);
+ packet->SetSize(len);
} else if (secure_required_) {
// This is a double check for something that supposedly can't happen.
LOG(LS_ERROR) << "Can't send outgoing " << PacketType(rtcp)
@@ -579,13 +579,14 @@
// Signal to the media sink after protecting the packet.
{
rtc::CritScope cs(&signal_send_packet_cs_);
- SignalSendPacketPostCrypto(packet->data(), packet->length(), rtcp);
+ SignalSendPacketPostCrypto(packet->data(), packet->size(), rtcp);
}
// Bon voyage.
- int ret = channel->SendPacket(packet->data(), packet->length(), options,
- (secure() && secure_dtls()) ? PF_SRTP_BYPASS : 0);
- if (ret != static_cast<int>(packet->length())) {
+ int ret =
+ channel->SendPacket(packet->data(), packet->size(), options,
+ (secure() && secure_dtls()) ? PF_SRTP_BYPASS : 0);
+ if (ret != static_cast<int>(packet->size())) {
if (channel->GetError() == EWOULDBLOCK) {
LOG(LS_WARNING) << "Got EWOULDBLOCK from socket.";
SetReadyToSend(channel, false);
@@ -599,13 +600,13 @@
// Protect ourselves against crazy data.
if (!ValidPacket(rtcp, packet)) {
LOG(LS_ERROR) << "Dropping incoming " << content_name_ << " "
- << PacketType(rtcp) << " packet: wrong size="
- << packet->length();
+ << PacketType(rtcp)
+ << " packet: wrong size=" << packet->size();
return false;
}
// Bundle filter handles both rtp and rtcp packets.
- return bundle_filter_.DemuxPacket(packet->data(), packet->length(), rtcp);
+ return bundle_filter_.DemuxPacket(packet->data(), packet->size(), rtcp);
}
void BaseChannel::HandlePacket(bool rtcp, rtc::Buffer* packet,
@@ -624,13 +625,13 @@
// Signal to the media sink before unprotecting the packet.
{
rtc::CritScope cs(&signal_recv_packet_cs_);
- SignalRecvPacketPostCrypto(packet->data(), packet->length(), rtcp);
+ SignalRecvPacketPostCrypto(packet->data(), packet->size(), rtcp);
}
// Unprotect the packet, if needed.
if (srtp_filter_.IsActive()) {
char* data = packet->data();
- int len = static_cast<int>(packet->length());
+ int len = static_cast<int>(packet->size());
bool res;
if (!rtcp) {
res = srtp_filter_.UnprotectRtp(data, len, &len);
@@ -655,7 +656,7 @@
}
}
- packet->SetLength(len);
+ packet->SetSize(len);
} else if (secure_required_) {
// Our session description indicates that SRTP is required, but we got a
// packet before our SRTP filter is active. This means either that
@@ -675,7 +676,7 @@
// Signal to the media sink after unprotecting the packet.
{
rtc::CritScope cs(&signal_recv_packet_cs_);
- SignalRecvPacketPreCrypto(packet->data(), packet->length(), rtcp);
+ SignalRecvPacketPreCrypto(packet->data(), packet->size(), rtcp);
}
// Push it down to the media channel.
@@ -2213,7 +2214,7 @@
if (data_channel_type_ == DCT_SCTP) {
// TODO(pthatcher): Do this in a more robust way by checking for
// SCTP or DTLS.
- return !IsRtpPacket(packet->data(), packet->length());
+ return !IsRtpPacket(packet->data(), packet->size());
} else if (data_channel_type_ == DCT_RTP) {
return BaseChannel::WantsPacket(rtcp, packet);
}
diff --git a/webrtc/base/buffer.cc b/webrtc/base/buffer.cc
index 04d888b..227a3b2 100644
--- a/webrtc/base/buffer.cc
+++ b/webrtc/base/buffer.cc
@@ -16,16 +16,20 @@
Construct(NULL, 0, 0);
}
-Buffer::Buffer(const void* data, size_t length) {
- Construct(data, length, length);
+Buffer::Buffer(size_t size) : Buffer() {
+ SetSize(size);
}
-Buffer::Buffer(const void* data, size_t length, size_t capacity) {
- Construct(data, length, capacity);
+Buffer::Buffer(const void* data, size_t size) {
+ Construct(data, size, size);
+}
+
+Buffer::Buffer(const void* data, size_t size, size_t capacity) {
+ Construct(data, size, capacity);
}
Buffer::Buffer(const Buffer& buf) {
- Construct(buf.data(), buf.length(), buf.length());
+ Construct(buf.data(), buf.size(), buf.size());
}
Buffer::~Buffer() = default;
diff --git a/webrtc/base/buffer.h b/webrtc/base/buffer.h
index a7bc570..c7fb959 100644
--- a/webrtc/base/buffer.h
+++ b/webrtc/base/buffer.h
@@ -23,50 +23,49 @@
class Buffer {
public:
Buffer();
- Buffer(const void* data, size_t length);
- Buffer(const void* data, size_t length, size_t capacity);
+ explicit Buffer(size_t size);
+ Buffer(const void* data, size_t size);
+ Buffer(const void* data, size_t size, size_t capacity);
Buffer(const Buffer& buf);
~Buffer();
const char* data() const { return data_.get(); }
char* data() { return data_.get(); }
- // TODO: should this be size(), like STL?
- size_t length() const { return length_; }
+ size_t size() const { return size_; }
size_t capacity() const { return capacity_; }
Buffer& operator=(const Buffer& buf) {
if (&buf != this) {
- Construct(buf.data(), buf.length(), buf.length());
+ Construct(buf.data(), buf.size(), buf.size());
}
return *this;
}
bool operator==(const Buffer& buf) const {
- return (length_ == buf.length() &&
- memcmp(data_.get(), buf.data(), length_) == 0);
+ return (size_ == buf.size() && memcmp(data_.get(), buf.data(), size_) == 0);
}
bool operator!=(const Buffer& buf) const {
return !operator==(buf);
}
- void SetData(const void* data, size_t length) {
- ASSERT(data != NULL || length == 0);
- SetLength(length);
- memcpy(data_.get(), data, length);
+ void SetData(const void* data, size_t size) {
+ ASSERT(data != NULL || size == 0);
+ SetSize(size);
+ memcpy(data_.get(), data, size);
}
- void AppendData(const void* data, size_t length) {
- ASSERT(data != NULL || length == 0);
- size_t old_length = length_;
- SetLength(length_ + length);
- memcpy(data_.get() + old_length, data, length);
+ void AppendData(const void* data, size_t size) {
+ ASSERT(data != NULL || size == 0);
+ size_t old_size = size_;
+ SetSize(size_ + size);
+ memcpy(data_.get() + old_size, data, size);
}
- void SetLength(size_t length) {
- SetCapacity(length);
- length_ = length;
+ void SetSize(size_t size) {
+ SetCapacity(size);
+ size_ = size;
}
void SetCapacity(size_t capacity) {
if (capacity > capacity_) {
rtc::scoped_ptr<char[]> data(new char[capacity]);
- memcpy(data.get(), data_.get(), length_);
+ memcpy(data.get(), data_.get(), size_);
data_.swap(data);
capacity_ = capacity;
}
@@ -75,19 +74,19 @@
void TransferTo(Buffer* buf) {
ASSERT(buf != NULL);
buf->data_.reset(data_.release());
- buf->length_ = length_;
+ buf->size_ = size_;
buf->capacity_ = capacity_;
Construct(NULL, 0, 0);
}
protected:
- void Construct(const void* data, size_t length, size_t capacity) {
+ void Construct(const void* data, size_t size, size_t capacity) {
data_.reset(new char[capacity_ = capacity]);
- SetData(data, length);
+ SetData(data, size);
}
scoped_ptr<char[]> data_;
- size_t length_;
+ size_t size_;
size_t capacity_;
};
diff --git a/webrtc/base/buffer_unittest.cc b/webrtc/base/buffer_unittest.cc
index 71b3f89..632ca81 100644
--- a/webrtc/base/buffer_unittest.cc
+++ b/webrtc/base/buffer_unittest.cc
@@ -19,21 +19,21 @@
TEST(BufferTest, TestConstructDefault) {
Buffer buf;
- EXPECT_EQ(0U, buf.length());
+ EXPECT_EQ(0U, buf.size());
EXPECT_EQ(0U, buf.capacity());
EXPECT_EQ(Buffer(), buf);
}
TEST(BufferTest, TestConstructEmptyWithCapacity) {
Buffer buf(NULL, 0, 256U);
- EXPECT_EQ(0U, buf.length());
+ EXPECT_EQ(0U, buf.size());
EXPECT_EQ(256U, buf.capacity());
EXPECT_EQ(Buffer(), buf);
}
TEST(BufferTest, TestConstructData) {
Buffer buf(kTestData, sizeof(kTestData));
- EXPECT_EQ(sizeof(kTestData), buf.length());
+ EXPECT_EQ(sizeof(kTestData), buf.size());
EXPECT_EQ(sizeof(kTestData), buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData)));
EXPECT_EQ(Buffer(kTestData, sizeof(kTestData)), buf);
@@ -41,7 +41,7 @@
TEST(BufferTest, TestConstructDataWithCapacity) {
Buffer buf(kTestData, sizeof(kTestData), 256U);
- EXPECT_EQ(sizeof(kTestData), buf.length());
+ EXPECT_EQ(sizeof(kTestData), buf.size());
EXPECT_EQ(256U, buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData)));
EXPECT_EQ(Buffer(kTestData, sizeof(kTestData)), buf);
@@ -49,7 +49,7 @@
TEST(BufferTest, TestConstructCopy) {
Buffer buf1(kTestData, sizeof(kTestData), 256), buf2(buf1);
- EXPECT_EQ(sizeof(kTestData), buf2.length());
+ EXPECT_EQ(sizeof(kTestData), buf2.size());
EXPECT_EQ(sizeof(kTestData), buf2.capacity()); // capacity isn't copied
EXPECT_EQ(0, memcmp(buf2.data(), kTestData, sizeof(kTestData)));
EXPECT_EQ(buf1, buf2);
@@ -59,7 +59,7 @@
Buffer buf1, buf2(kTestData, sizeof(kTestData), 256);
EXPECT_NE(buf1, buf2);
buf1 = buf2;
- EXPECT_EQ(sizeof(kTestData), buf1.length());
+ EXPECT_EQ(sizeof(kTestData), buf1.size());
EXPECT_EQ(sizeof(kTestData), buf1.capacity()); // capacity isn't copied
EXPECT_EQ(0, memcmp(buf1.data(), kTestData, sizeof(kTestData)));
EXPECT_EQ(buf1, buf2);
@@ -68,7 +68,7 @@
TEST(BufferTest, TestSetData) {
Buffer buf;
buf.SetData(kTestData, sizeof(kTestData));
- EXPECT_EQ(sizeof(kTestData), buf.length());
+ EXPECT_EQ(sizeof(kTestData), buf.size());
EXPECT_EQ(sizeof(kTestData), buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData)));
}
@@ -76,27 +76,27 @@
TEST(BufferTest, TestAppendData) {
Buffer buf(kTestData, sizeof(kTestData));
buf.AppendData(kTestData, sizeof(kTestData));
- EXPECT_EQ(2 * sizeof(kTestData), buf.length());
+ EXPECT_EQ(2 * sizeof(kTestData), buf.size());
EXPECT_EQ(2 * sizeof(kTestData), buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData)));
EXPECT_EQ(0, memcmp(buf.data() + sizeof(kTestData),
kTestData, sizeof(kTestData)));
}
-TEST(BufferTest, TestSetLengthSmaller) {
+TEST(BufferTest, TestSetSizeSmaller) {
Buffer buf;
buf.SetData(kTestData, sizeof(kTestData));
- buf.SetLength(sizeof(kTestData) / 2);
- EXPECT_EQ(sizeof(kTestData) / 2, buf.length());
+ buf.SetSize(sizeof(kTestData) / 2);
+ EXPECT_EQ(sizeof(kTestData) / 2, buf.size());
EXPECT_EQ(sizeof(kTestData), buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData) / 2));
}
-TEST(BufferTest, TestSetLengthLarger) {
+TEST(BufferTest, TestSetSizeLarger) {
Buffer buf;
buf.SetData(kTestData, sizeof(kTestData));
- buf.SetLength(sizeof(kTestData) * 2);
- EXPECT_EQ(sizeof(kTestData) * 2, buf.length());
+ buf.SetSize(sizeof(kTestData) * 2);
+ EXPECT_EQ(sizeof(kTestData) * 2, buf.size());
EXPECT_EQ(sizeof(kTestData) * 2, buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData)));
}
@@ -105,7 +105,7 @@
Buffer buf;
buf.SetData(kTestData, sizeof(kTestData));
buf.SetCapacity(sizeof(kTestData) / 2); // should be ignored
- EXPECT_EQ(sizeof(kTestData), buf.length());
+ EXPECT_EQ(sizeof(kTestData), buf.size());
EXPECT_EQ(sizeof(kTestData), buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData)));
}
@@ -113,17 +113,17 @@
TEST(BufferTest, TestSetCapacityLarger) {
Buffer buf(kTestData, sizeof(kTestData));
buf.SetCapacity(sizeof(kTestData) * 2);
- EXPECT_EQ(sizeof(kTestData), buf.length());
+ EXPECT_EQ(sizeof(kTestData), buf.size());
EXPECT_EQ(sizeof(kTestData) * 2, buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData)));
}
-TEST(BufferTest, TestSetCapacityThenSetLength) {
+TEST(BufferTest, TestSetCapacityThenSetSize) {
Buffer buf(kTestData, sizeof(kTestData));
buf.SetCapacity(sizeof(kTestData) * 4);
memcpy(buf.data() + sizeof(kTestData), kTestData, sizeof(kTestData));
- buf.SetLength(sizeof(kTestData) * 2);
- EXPECT_EQ(sizeof(kTestData) * 2, buf.length());
+ buf.SetSize(sizeof(kTestData) * 2);
+ EXPECT_EQ(sizeof(kTestData) * 2, buf.size());
EXPECT_EQ(sizeof(kTestData) * 4, buf.capacity());
EXPECT_EQ(0, memcmp(buf.data(), kTestData, sizeof(kTestData)));
EXPECT_EQ(0, memcmp(buf.data() + sizeof(kTestData),
@@ -133,9 +133,9 @@
TEST(BufferTest, TestTransfer) {
Buffer buf1(kTestData, sizeof(kTestData), 256U), buf2;
buf1.TransferTo(&buf2);
- EXPECT_EQ(0U, buf1.length());
+ EXPECT_EQ(0U, buf1.size());
EXPECT_EQ(0U, buf1.capacity());
- EXPECT_EQ(sizeof(kTestData), buf2.length());
+ EXPECT_EQ(sizeof(kTestData), buf2.size());
EXPECT_EQ(256U, buf2.capacity()); // capacity does transfer
EXPECT_EQ(0, memcmp(buf2.data(), kTestData, sizeof(kTestData)));
}
diff --git a/webrtc/base/sslfingerprint.cc b/webrtc/base/sslfingerprint.cc
index 1419243..d45e7a0 100644
--- a/webrtc/base/sslfingerprint.cc
+++ b/webrtc/base/sslfingerprint.cc
@@ -79,8 +79,7 @@
std::string SSLFingerprint::GetRfc4572Fingerprint() const {
std::string fingerprint =
- rtc::hex_encode_with_delimiter(
- digest.data(), digest.length(), ':');
+ rtc::hex_encode_with_delimiter(digest.data(), digest.size(), ':');
std::transform(fingerprint.begin(), fingerprint.end(),
fingerprint.begin(), ::toupper);
return fingerprint;
diff --git a/webrtc/base/stream.cc b/webrtc/base/stream.cc
index 4a85c9f..0fdb1fc 100644
--- a/webrtc/base/stream.cc
+++ b/webrtc/base/stream.cc
@@ -754,7 +754,7 @@
size_t previous_buffer_length = 0;
{
CritScope cs(&crit_buffer_);
- previous_buffer_length = buffer_.length();
+ previous_buffer_length = buffer_.size();
buffer_.AppendData(data, data_len);
}
@@ -793,9 +793,9 @@
buffer_.TransferTo(&to_write);
}
- if (to_write.length() > 0) {
+ if (to_write.size() > 0) {
CritScope cs(&crit_stream_);
- stream_->WriteAll(to_write.data(), to_write.length(), NULL, NULL);
+ stream_->WriteAll(to_write.data(), to_write.size(), NULL, NULL);
}
}
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index fa9fca5..a55ca97 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -1354,13 +1354,13 @@
// Verify that this packet doesn't have CVO byte.
VerifyCVOPacket(
reinterpret_cast<uint8_t*>(transport_.sent_packets_[0]->data()),
- transport_.sent_packets_[0]->length(), false, &map, kSeqNum,
+ transport_.sent_packets_[0]->size(), false, &map, kSeqNum,
kVideoRotation_0);
// Verify that this packet doesn't have CVO byte.
VerifyCVOPacket(
reinterpret_cast<uint8_t*>(transport_.sent_packets_[1]->data()),
- transport_.sent_packets_[1]->length(), true, &map, kSeqNum + 1,
+ transport_.sent_packets_[1]->size(), true, &map, kSeqNum + 1,
hdr.rotation);
}
} // namespace webrtc
diff --git a/webrtc/p2p/base/dtlstransport.h b/webrtc/p2p/base/dtlstransport.h
index bb80dc8..8e17ea6 100644
--- a/webrtc/p2p/base/dtlstransport.h
+++ b/webrtc/p2p/base/dtlstransport.h
@@ -220,10 +220,9 @@
}
// Apply remote fingerprint.
if (!channel->SetRemoteFingerprint(
- remote_fingerprint_->algorithm,
- reinterpret_cast<const uint8 *>(remote_fingerprint_->
- digest.data()),
- remote_fingerprint_->digest.length())) {
+ remote_fingerprint_->algorithm,
+ reinterpret_cast<const uint8*>(remote_fingerprint_->digest.data()),
+ remote_fingerprint_->digest.size())) {
return BadTransportDescription("Failed to apply remote fingerprint.",
error_desc);
}
diff --git a/webrtc/p2p/base/dtlstransportchannel.cc b/webrtc/p2p/base/dtlstransportchannel.cc
index 956c52a..ca561a0 100644
--- a/webrtc/p2p/base/dtlstransportchannel.cc
+++ b/webrtc/p2p/base/dtlstransportchannel.cc
@@ -263,8 +263,8 @@
dtls_->SignalEvent.connect(this, &DtlsTransportChannelWrapper::OnDtlsEvent);
if (!dtls_->SetPeerCertificateDigest(
remote_fingerprint_algorithm_,
- reinterpret_cast<unsigned char *>(remote_fingerprint_value_.data()),
- remote_fingerprint_value_.length())) {
+ reinterpret_cast<unsigned char*>(remote_fingerprint_value_.data()),
+ remote_fingerprint_value_.size())) {
LOG_J(LS_ERROR, this) << "Couldn't set DTLS certificate digest.";
return false;
}
diff --git a/webrtc/p2p/base/fakesession.h b/webrtc/p2p/base/fakesession.h
index 5486e46..5d07d25 100644
--- a/webrtc/p2p/base/fakesession.h
+++ b/webrtc/p2p/base/fakesession.h
@@ -213,8 +213,7 @@
virtual void OnMessage(rtc::Message* msg) {
PacketMessageData* data = static_cast<PacketMessageData*>(
msg->pdata);
- dest_->SignalReadPacket(dest_, data->packet.data(),
- data->packet.length(),
+ dest_->SignalReadPacket(dest_, data->packet.data(), data->packet.size(),
rtc::CreatePacketTime(0), 0);
delete data;
}
diff --git a/webrtc/p2p/base/transportdescriptionfactory_unittest.cc b/webrtc/p2p/base/transportdescriptionfactory_unittest.cc
index 22816a2..48267b5 100644
--- a/webrtc/p2p/base/transportdescriptionfactory_unittest.cc
+++ b/webrtc/p2p/base/transportdescriptionfactory_unittest.cc
@@ -50,7 +50,7 @@
} else {
ASSERT_TRUE(desc->identity_fingerprint.get() != NULL);
EXPECT_EQ(desc->identity_fingerprint->algorithm, dtls_alg);
- EXPECT_GT(desc->identity_fingerprint->digest.length(), 0U);
+ EXPECT_GT(desc->identity_fingerprint->digest.size(), 0U);
}
}
diff --git a/webrtc/p2p/base/turnport_unittest.cc b/webrtc/p2p/base/turnport_unittest.cc
index da2c6b9..3172ba2 100644
--- a/webrtc/p2p/base/turnport_unittest.cc
+++ b/webrtc/p2p/base/turnport_unittest.cc
@@ -437,8 +437,8 @@
ASSERT_EQ_WAIT(num_packets, turn_packets_.size(), kTimeout);
ASSERT_EQ_WAIT(num_packets, udp_packets_.size(), kTimeout);
for (size_t i = 0; i < num_packets; ++i) {
- EXPECT_EQ(i + 1, turn_packets_[i].length());
- EXPECT_EQ(i + 1, udp_packets_[i].length());
+ EXPECT_EQ(i + 1, turn_packets_[i].size());
+ EXPECT_EQ(i + 1, udp_packets_[i].size());
EXPECT_EQ(turn_packets_[i], udp_packets_[i]);
}
}