Convert all webrtc code to not access EncodedImage::_size directly.
Read using capacity() method, write using set_buffer() method. This is a preparation for making the member private, and renaming it to capacity_. Bug: webrtc:9378 Change-Id: I2f96679d052a83fe81be40301bd9863c87074640 Reviewed-on: https://webrtc-review.googlesource.com/c/113520 Reviewed-by: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25934}
This commit is contained in:
@ -82,8 +82,8 @@ class SimulcastTestFixtureImpl::TestEncodedImageCallback
|
||||
if (encoded_image.SpatialIndex().value_or(0) == 0) {
|
||||
if (encoded_image._frameType == kVideoFrameKey) {
|
||||
delete[] encoded_key_frame_._buffer;
|
||||
encoded_key_frame_._buffer = new uint8_t[encoded_image._size];
|
||||
encoded_key_frame_._size = encoded_image._size;
|
||||
encoded_key_frame_.set_buffer(new uint8_t[encoded_image.capacity()],
|
||||
encoded_image.capacity());
|
||||
encoded_key_frame_._length = encoded_image._length;
|
||||
encoded_key_frame_._frameType = kVideoFrameKey;
|
||||
encoded_key_frame_._completeFrame = encoded_image._completeFrame;
|
||||
@ -91,8 +91,8 @@ class SimulcastTestFixtureImpl::TestEncodedImageCallback
|
||||
encoded_image._length);
|
||||
} else {
|
||||
delete[] encoded_frame_._buffer;
|
||||
encoded_frame_._buffer = new uint8_t[encoded_image._size];
|
||||
encoded_frame_._size = encoded_image._size;
|
||||
encoded_frame_.set_buffer(new uint8_t[encoded_image.capacity()],
|
||||
encoded_image.capacity());
|
||||
encoded_frame_._length = encoded_image._length;
|
||||
memcpy(encoded_frame_._buffer, encoded_image._buffer,
|
||||
encoded_image._length);
|
||||
@ -838,8 +838,9 @@ void SimulcastTestFixtureImpl::TestDecodeWidthHeightSet() {
|
||||
EXPECT_EQ(encoded_image._frameType, kVideoFrameKey);
|
||||
|
||||
size_t index = encoded_image.SpatialIndex().value_or(0);
|
||||
encoded_frame[index]._buffer = new uint8_t[encoded_image._size];
|
||||
encoded_frame[index]._size = encoded_image._size;
|
||||
encoded_frame[index].set_buffer(
|
||||
new uint8_t[encoded_image.capacity()],
|
||||
encoded_image.capacity());
|
||||
encoded_frame[index]._length = encoded_image._length;
|
||||
encoded_frame[index]._frameType = encoded_image._frameType;
|
||||
encoded_frame[index]._completeFrame = encoded_image._completeFrame;
|
||||
|
Reference in New Issue
Block a user