Performance fix for H264 RBSP parsing.

An rtc::Buffer is used to write output of RBSP parsing, usually one byte
at a time. It turns out that container will then expand its capacity one
byte at a time, for each byte reallocating the whole buffer and copying
the contents over, turning this into an O(n^2) operation.

Fix is for now only to preallocate the container storage. Longer term, I
think we should mull over if we really need custom containers...

R=pbos@webrtc.org
TBR=mflodman@webrtc.org
BUG=

Review URL: https://codereview.webrtc.org/2073763002 .

Cr-Commit-Position: refs/heads/master@{#13167}
This commit is contained in:
Erik Språng
2016-06-16 15:54:44 +02:00
parent fc3a8ee47b
commit 1642620a7d
2 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#ifndef WEBRTC_BASE_BUFFER_H_
#define WEBRTC_BASE_BUFFER_H_
#include <algorithm>
#include <cstring>
#include <memory>
#include <type_traits>