Add performance optimization for empty RtpPacketInfos.

Bug: webrtc:10668
Change-Id: I879afbb2d6aad77e9db97f8b6a938bf760aab9f5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/146703
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Chen Xing <chxg@google.com>
Cr-Commit-Position: refs/heads/master@{#28653}
This commit is contained in:
Chen Xing
2019-07-24 10:58:52 +02:00
committed by Commit Bot
parent bc6f113bd2
commit 1796a820f6

View File

@ -76,6 +76,11 @@ class RtpPacketInfos {
class Data : public rtc::RefCountedBase {
public:
static rtc::scoped_refptr<Data> Create(vector_type entries) {
// Performance optimization for the empty case.
if (entries.empty()) {
return nullptr;
}
return new Data(entries);
}