Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Unified Diff: remoting/codec/codec_test.cc

Issue 10871068: Cleaned up codec_test.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698