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

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_packet.cc

Issue 2217383002: Use RtpPacketToSend in RtpSenderVideo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Expand comment about non-trivial minor optimization in rtp::Packet::AllocatePayload Created 4 years, 3 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 | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/rtp_rtcp/source/rtp_packet.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet.cc b/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
index 283512cd8fa51e7d7dc74da62f5cc116f9051ad3..2362ff23934b0ac3e623a28bafa8219d688d1df8 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet.cc
@@ -274,6 +274,9 @@ uint8_t* Packet::AllocatePayload(size_t size_bytes) {
LOG(LS_WARNING) << "Cannot set payload, not enough space in buffer.";
return nullptr;
}
+ // Reset payload size to 0. If CopyOnWrite buffer_ was shared, this will cause
+ // reallocation and memcpy. Setting size to just headers reduces memcpy size.
+ buffer_.SetSize(payload_offset_);
payload_size_ = size_bytes;
buffer_.SetSize(payload_offset_ + payload_size_);
return WriteAt(payload_offset_);
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698