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}
diff --git a/modules/video_coding/frame_buffer.cc b/modules/video_coding/frame_buffer.cc
index 755acb2..d30170a 100644
--- a/modules/video_coding/frame_buffer.cc
+++ b/modules/video_coding/frame_buffer.cc
@@ -98,15 +98,16 @@
}
}
+ 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.";