Chromium Code Reviews| Index: remoting/codec/codec_test.cc |
| diff --git a/remoting/codec/codec_test.cc b/remoting/codec/codec_test.cc |
| index 6f3a4aebb53610044e15bf8ee15e8cc3f650c635..39a07123efd5c2c50dd1b0a5c0eda2af95d2e73a 100644 |
| --- a/remoting/codec/codec_test.cc |
| +++ b/remoting/codec/codec_test.cc |
| @@ -319,12 +319,11 @@ class VideoEncoderTester { |
| scoped_refptr<CaptureData> PrepareEncodeData(const SkISize& size, |
| media::VideoFrame::Format format, |
| - uint8** memory) { |
| + scoped_array<uint8>* memory) { |
| // TODO(hclam): Support also YUV format. |
| CHECK_EQ(format, media::VideoFrame::RGB32); |
| int memory_size = size.width() * size.height() * kBytesPerPixel; |
| - *memory = new uint8[memory_size]; |
|
Wez
2012/08/24 20:57:31
This allocates a buffer of the necessary size; you
kxing
2012/08/24 21:28:30
Done.
|
| srand(0); |
| for (int i = 0; i < memory_size; ++i) { |
| (*memory)[i] = rand() % 256; |
| @@ -333,7 +332,7 @@ scoped_refptr<CaptureData> PrepareEncodeData(const SkISize& size, |
| DataPlanes planes; |
| memset(planes.data, 0, sizeof(planes.data)); |
| memset(planes.strides, 0, sizeof(planes.strides)); |
| - planes.data[0] = *memory; |
| + planes.data[0] = memory->get(); |
| planes.strides[0] = size.width() * kBytesPerPixel; |
| scoped_refptr<CaptureData> data = |
| @@ -363,10 +362,10 @@ void TestVideoEncoder(VideoEncoder* encoder, bool strict) { |
| VideoEncoderTester tester(&message_tester); |
| - uint8* memory; |
| + scoped_array<uint8> memory( |
| + new uint8[kSize.width() * kSize.height() * kBytesPerPixel]); |
|
Wez
2012/08/24 20:57:31
Move this back into PrepareEncodeData, as per prev
kxing
2012/08/24 21:28:30
Done.
|
| scoped_refptr<CaptureData> data = |
| PrepareEncodeData(kSize, media::VideoFrame::RGB32, &memory); |
| - scoped_array<uint8> memory_wrapper(memory); |
| std::vector<std::vector<SkIRect> > test_rect_lists = MakeTestRectLists(kSize); |
| for (size_t i = 0; i < test_rect_lists.size(); ++i) { |
| @@ -416,10 +415,10 @@ void TestVideoEncoderDecoder( |
| VideoEncoderTester encoder_tester(&message_tester); |
| - uint8* memory; |
| + scoped_array<uint8> memory( |
| + new uint8[kSize.width() * kSize.height() * kBytesPerPixel]); |
| scoped_refptr<CaptureData> data = |
| PrepareEncodeData(kSize, media::VideoFrame::RGB32, &memory); |
| - scoped_array<uint8> memory_wrapper(memory); |
| VideoDecoderTester decoder_tester(decoder, kSize, kSize); |
| decoder_tester.set_strict(strict); |