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

Unified Diff: webrtc/media/engine/webrtcvideoengine2.cc

Issue 1785713005: Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Feedback from tommi. 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoengine2.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2.cc b/webrtc/media/engine/webrtcvideoengine2.cc
index daffc2fd3419f66ff615a90fd7a576d43fd744c9..29fda0b72088db5cee9d6f915f8e9c18e0aedb56 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"
@@ -1287,14 +1287,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:
@@ -1306,12 +1306,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;
}
@@ -1337,7 +1337,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;
@@ -1345,7 +1345,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);
@@ -1355,7 +1355,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);
}
@@ -1411,14 +1411,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());
}
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.h ('k') | webrtc/media/engine/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698