Demote method EncodedImage::capacity() to private.

Bug: webrtc:9378
Change-Id: I83be267334fc778aff4eb2ad128d3ed693f755ff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/185007
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32177}
This commit is contained in:
Niels Möller
2020-09-23 14:26:42 +02:00
committed by Commit Bot
parent 2a4d6634b2
commit d60e32a953
5 changed files with 10 additions and 23 deletions

View File

@ -98,15 +98,16 @@ VCMFrameBufferEnum VCMFrameBuffer::InsertPacket(const VCMPacket& packet,
}
}
size_t oldSize = encoded_image_buffer_ ? encoded_image_buffer_->size() : 0;
uint32_t requiredSizeBytes =
size() + packet.sizeBytes +
(packet.insertStartCode ? kH264StartCodeLengthBytes : 0);
if (requiredSizeBytes > capacity()) {
if (requiredSizeBytes > oldSize) {
const uint8_t* prevBuffer = data();
const uint32_t increments =
requiredSizeBytes / kBufferIncStepSizeBytes +
(requiredSizeBytes % kBufferIncStepSizeBytes > 0);
const uint32_t newSize = capacity() + increments * kBufferIncStepSizeBytes;
const uint32_t newSize = oldSize + increments * kBufferIncStepSizeBytes;
if (newSize > kMaxJBFrameSizeBytes) {
RTC_LOG(LS_ERROR) << "Failed to insert packet due to frame being too "
"big.";