Refactor legacy FrameBuffer to use EncodedImageBuffer::Realloc
Preparation for deleting VCMEncodedFrame::VerifyAndAllocate and EncodedImage::Allocate. Bug: webrtc:9378 Change-Id: If7c16061962bbd58c3e7d5720189854e00a3d7bf Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/154570 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29339}
This commit is contained in:
@ -52,6 +52,11 @@ size_t EncodedImageBuffer::size() const {
|
||||
}
|
||||
|
||||
void EncodedImageBuffer::Realloc(size_t size) {
|
||||
// Calling realloc with size == 0 is equivalent to free, and returns nullptr.
|
||||
// Which is confusing on systems where malloc(0) doesn't return a nullptr.
|
||||
// More specifically, it breaks expectations of
|
||||
// VCMSessionInfo::UpdateDataPointers.
|
||||
RTC_DCHECK(size > 0);
|
||||
buffer_ = static_cast<uint8_t*>(realloc(buffer_, size));
|
||||
size_ = size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user