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

Unified Diff: webrtc/media/base/rtpdataengine.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.cc
diff --git a/webrtc/media/base/rtpdataengine.cc b/webrtc/media/base/rtpdataengine.cc
index 705ccbdaff771842e3838c6a0341299145541690..ae3617455573754271c16d94dcd6125083aaa991 100644
--- a/webrtc/media/base/rtpdataengine.cc
+++ b/webrtc/media/base/rtpdataengine.cc
@@ -10,7 +10,7 @@
#include "webrtc/media/base/rtpdataengine.h"
-#include "webrtc/base/buffer.h"
+#include "webrtc/base/copyonwritebuffer.h"
#include "webrtc/base/helpers.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/ratelimiter.h"
@@ -205,9 +205,9 @@ bool RtpDataMediaChannel::RemoveRecvStream(uint32_t ssrc) {
}
void RtpDataMediaChannel::OnPacketReceived(
- rtc::Buffer* packet, const rtc::PacketTime& packet_time) {
+ rtc::CopyOnWriteBuffer* packet, const rtc::PacketTime& packet_time) {
RtpHeader header;
- if (!GetRtpHeader(packet->data(), packet->size(), &header)) {
+ if (!GetRtpHeader(packet->cdata(), 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() << ".";
@@ -215,7 +215,7 @@ void RtpDataMediaChannel::OnPacketReceived(
}
size_t header_length;
- if (!GetRtpHeaderLen(packet->data(), packet->size(), &header_length)) {
+ if (!GetRtpHeaderLen(packet->cdata(), 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 "
@@ -223,7 +223,7 @@ void RtpDataMediaChannel::OnPacketReceived(
return;
}
const char* data =
- packet->data<char>() + header_length + sizeof(kReservedSpace);
+ packet->cdata<char>() + header_length + sizeof(kReservedSpace);
size_t data_len = packet->size() - header_length - sizeof(kReservedSpace);
if (!receiving_) {
@@ -276,7 +276,7 @@ bool RtpDataMediaChannel::SetMaxSendBandwidth(int bps) {
bool RtpDataMediaChannel::SendData(
const SendDataParams& params,
- const rtc::Buffer& payload,
+ const rtc::CopyOnWriteBuffer& payload,
SendDataResult* result) {
if (result) {
// If we return true, we'll set this to SDR_SUCCESS.
@@ -329,7 +329,7 @@ bool RtpDataMediaChannel::SendData(
rtp_clock_by_send_ssrc_[header.ssrc]->Tick(
now, &header.seq_num, &header.timestamp);
- rtc::Buffer packet(kMinRtpPacketLen, packet_len);
+ rtc::CopyOnWriteBuffer packet(kMinRtpPacketLen, packet_len);
if (!SetRtpHeader(packet.data(), packet.size(), header)) {
return false;
}

Powered by Google App Engine
This is Rietveld 408576698