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

Unified Diff: webrtc/media/base/rtpdataengine_unittest.cc

Issue 1823503002: Reland Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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
Index: webrtc/media/base/rtpdataengine_unittest.cc
diff --git a/webrtc/media/base/rtpdataengine_unittest.cc b/webrtc/media/base/rtpdataengine_unittest.cc
index 2a9b25e2774675b5e5bc5824026d917ca87fd854..b5cfd3255189e6444788247030fe4aefae4bd280 100644
--- a/webrtc/media/base/rtpdataengine_unittest.cc
+++ b/webrtc/media/base/rtpdataengine_unittest.cc
@@ -11,7 +11,7 @@
#include <memory>
#include <string>
-#include "webrtc/base/buffer.h"
+#include "webrtc/base/copyonwritebuffer.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/helpers.h"
#include "webrtc/base/ssladapter.h"
@@ -124,7 +124,7 @@ class RtpDataMediaChannelTest : public testing::Test {
std::string GetSentData(int index) {
// Assume RTP header of length 12
- std::unique_ptr<const rtc::Buffer> packet(
+ std::unique_ptr<const rtc::CopyOnWriteBuffer> packet(
iface_->GetRtpPacket(index));
if (packet->size() > 12) {
return std::string(packet->data<char>() + 12, packet->size() - 12);
@@ -134,7 +134,7 @@ class RtpDataMediaChannelTest : public testing::Test {
}
cricket::RtpHeader GetSentDataHeader(int index) {
- std::unique_ptr<const rtc::Buffer> packet(
+ std::unique_ptr<const rtc::CopyOnWriteBuffer> packet(
iface_->GetRtpPacket(index));
cricket::RtpHeader header;
GetRtpHeader(packet->data(), packet->size(), &header);
@@ -220,7 +220,7 @@ TEST_F(RtpDataMediaChannelTest, SendData) {
cricket::SendDataParams params;
params.ssrc = 42;
unsigned char data[] = "food";
- rtc::Buffer payload(data, 4);
+ rtc::CopyOnWriteBuffer payload(data, 4);
unsigned char padded_data[] = {
0x00, 0x00, 0x00, 0x00,
'f', 'o', 'o', 'd',
@@ -257,7 +257,7 @@ TEST_F(RtpDataMediaChannelTest, SendData) {
// Length too large;
std::string x10000(10000, 'x');
EXPECT_FALSE(dmc->SendData(
- params, rtc::Buffer(x10000.data(), x10000.length()), &result));
+ params, rtc::CopyOnWriteBuffer(x10000.data(), x10000.length()), &result));
EXPECT_EQ(cricket::SDR_ERROR, result);
EXPECT_FALSE(HasSentData(0));
@@ -325,7 +325,7 @@ TEST_F(RtpDataMediaChannelTest, SendDataMultipleClocks) {
params2.ssrc = 42;
unsigned char data[] = "foo";
- rtc::Buffer payload(data, 3);
+ rtc::CopyOnWriteBuffer payload(data, 3);
cricket::SendDataResult result;
EXPECT_TRUE(dmc1->SendData(params1, payload, &result));
@@ -372,7 +372,7 @@ TEST_F(RtpDataMediaChannelTest, SendDataRate) {
cricket::SendDataParams params;
params.ssrc = 42;
unsigned char data[] = "food";
- rtc::Buffer payload(data, 4);
+ rtc::CopyOnWriteBuffer payload(data, 4);
cricket::SendDataResult result;
// With rtp overhead of 32 bytes, each one of our packets is 36
@@ -410,7 +410,7 @@ TEST_F(RtpDataMediaChannelTest, ReceiveData) {
0x00, 0x00, 0x00, 0x00,
'a', 'b', 'c', 'd', 'e'
};
- rtc::Buffer packet(data, sizeof(data));
+ rtc::CopyOnWriteBuffer packet(data, sizeof(data));
std::unique_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());
@@ -450,7 +450,7 @@ TEST_F(RtpDataMediaChannelTest, InvalidRtpPackets) {
unsigned char data[] = {
0x80, 0x65, 0x00, 0x02
};
- rtc::Buffer packet(data, sizeof(data));
+ rtc::CopyOnWriteBuffer packet(data, sizeof(data));
std::unique_ptr<cricket::RtpDataMediaChannel> dmc(CreateChannel());

Powered by Google App Engine
This is Rietveld 408576698