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

Unified Diff: webrtc/media/engine/webrtcvideoengine2.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/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index 83f81f0f427e2135f2ffce6a51c84aa575ccd79e..122edfe09297a35d13be960cb912f1c1aa85c58b 100644
--- a/webrtc/media/engine/webrtcvideoengine2.cc
+++ b/webrtc/media/engine/webrtcvideoengine2.cc
@@ -14,7 +14,7 @@
#include <set>
#include <string>
-#include "webrtc/base/buffer.h"
+#include "webrtc/base/copyonwritebuffer.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/stringutils.h"
#include "webrtc/base/timeutils.h"
@@ -1300,14 +1300,14 @@ bool WebRtcVideoChannel2::SetCapturer(uint32_t ssrc, VideoCapturer* capturer) {
}
void WebRtcVideoChannel2::OnPacketReceived(
- rtc::Buffer* packet,
+ rtc::CopyOnWriteBuffer* packet,
const rtc::PacketTime& packet_time) {
const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp,
packet_time.not_before);
const webrtc::PacketReceiver::DeliveryStatus delivery_result =
call_->Receiver()->DeliverPacket(
webrtc::MediaType::VIDEO,
- reinterpret_cast<const uint8_t*>(packet->data()), packet->size(),
+ packet->cdata(), packet->size(),
webrtc_packet_time);
switch (delivery_result) {
case webrtc::PacketReceiver::DELIVERY_OK:
@@ -1319,12 +1319,12 @@ void WebRtcVideoChannel2::OnPacketReceived(
}
uint32_t ssrc = 0;
- if (!GetRtpSsrc(packet->data(), packet->size(), &ssrc)) {
+ if (!GetRtpSsrc(packet->cdata(), packet->size(), &ssrc)) {
return;
}
int payload_type = 0;
- if (!GetRtpPayloadType(packet->data(), packet->size(), &payload_type)) {
+ if (!GetRtpPayloadType(packet->cdata(), packet->size(), &payload_type)) {
return;
}
@@ -1350,7 +1350,7 @@ void WebRtcVideoChannel2::OnPacketReceived(
if (call_->Receiver()->DeliverPacket(
webrtc::MediaType::VIDEO,
- reinterpret_cast<const uint8_t*>(packet->data()), packet->size(),
+ packet->cdata(), packet->size(),
webrtc_packet_time) != webrtc::PacketReceiver::DELIVERY_OK) {
LOG(LS_WARNING) << "Failed to deliver RTP packet on re-delivery.";
return;
@@ -1358,7 +1358,7 @@ void WebRtcVideoChannel2::OnPacketReceived(
}
void WebRtcVideoChannel2::OnRtcpReceived(
- rtc::Buffer* packet,
+ rtc::CopyOnWriteBuffer* packet,
const rtc::PacketTime& packet_time) {
const webrtc::PacketTime webrtc_packet_time(packet_time.timestamp,
packet_time.not_before);
@@ -1368,7 +1368,7 @@ void WebRtcVideoChannel2::OnRtcpReceived(
// logging failures spam the log).
call_->Receiver()->DeliverPacket(
webrtc::MediaType::VIDEO,
- reinterpret_cast<const uint8_t*>(packet->data()), packet->size(),
+ packet->cdata(), packet->size(),
webrtc_packet_time);
}
@@ -1424,14 +1424,14 @@ void WebRtcVideoChannel2::SetInterface(NetworkInterface* iface) {
bool WebRtcVideoChannel2::SendRtp(const uint8_t* data,
size_t len,
const webrtc::PacketOptions& options) {
- rtc::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::CopyOnWriteBuffer packet(data, len, kMaxRtpPacketLen);
rtc::PacketOptions rtc_options;
rtc_options.packet_id = options.packet_id;
return MediaChannel::SendPacket(&packet, rtc_options);
}
bool WebRtcVideoChannel2::SendRtcp(const uint8_t* data, size_t len) {
- rtc::Buffer packet(data, len, kMaxRtpPacketLen);
+ rtc::CopyOnWriteBuffer packet(data, len, kMaxRtpPacketLen);
return MediaChannel::SendRtcp(&packet, rtc::PacketOptions());
}

Powered by Google App Engine
This is Rietveld 408576698