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

Unified Diff: webrtc/common_video/h264/h264_common.cc

Issue 2073763002: Performance fix for H264 RBSP parsing. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Missing include in base/buffer.h Created 4 years, 6 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/base/buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/h264/h264_common.cc
diff --git a/webrtc/common_video/h264/h264_common.cc b/webrtc/common_video/h264/h264_common.cc
index efdaded1e048db17b96aae030b79ff34daa39ad7..c17b118ce0b354e16d2cfab42151a0127f119cf4 100644
--- a/webrtc/common_video/h264/h264_common.cc
+++ b/webrtc/common_video/h264/h264_common.cc
@@ -59,7 +59,7 @@ NaluType ParseNaluType(uint8_t data) {
}
std::unique_ptr<rtc::Buffer> ParseRbsp(const uint8_t* data, size_t length) {
- std::unique_ptr<rtc::Buffer> rbsp_buffer(new rtc::Buffer());
+ std::unique_ptr<rtc::Buffer> rbsp_buffer(new rtc::Buffer(0, length));
const char* sps_bytes = reinterpret_cast<const char*>(data);
for (size_t i = 0; i < length;) {
// Be careful about over/underflow here. byte_length_ - 3 can underflow, and
@@ -84,6 +84,7 @@ void WriteRbsp(const uint8_t* bytes, size_t length, rtc::Buffer* destination) {
static const uint8_t kZerosInStartSequence = 2;
static const uint8_t kEmulationByte = 0x03u;
size_t num_consecutive_zeros = 0;
+ destination->EnsureCapacity(destination->size() + length);
for (size_t i = 0; i < length; ++i) {
uint8_t byte = bytes[i];
« no previous file with comments | « webrtc/base/buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698