OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <deque> | 7 #include <deque> |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 int width, int height, int num_frames, | 43 int width, int height, int num_frames, |
44 std::deque<scoped_refptr<media::VideoFrame> >& out_frames) { | 44 std::deque<scoped_refptr<media::VideoFrame> >& out_frames) { |
45 FILE* file_handle = fopen(file_name.c_str(), "rb"); | 45 FILE* file_handle = fopen(file_name.c_str(), "rb"); |
46 if (!file_handle) { | 46 if (!file_handle) { |
47 printf("Could not open %s\n", file_name.c_str()); | 47 printf("Could not open %s\n", file_name.c_str()); |
48 exit(1); | 48 exit(1); |
49 } | 49 } |
50 | 50 |
51 long frame_size = CalculateYUVFrameSize(file_handle, num_frames); | 51 long frame_size = CalculateYUVFrameSize(file_handle, num_frames); |
52 | 52 |
| 53 gfx::Size size(width, height); |
53 for (int i = 0; i < num_frames; i++) { | 54 for (int i = 0; i < num_frames; i++) { |
54 scoped_refptr<media::VideoFrame> video_frame = | 55 scoped_refptr<media::VideoFrame> video_frame = |
55 media::VideoFrame::CreateFrame(media::VideoFrame::YV12, | 56 media::VideoFrame::CreateFrame(media::VideoFrame::YV12, size, size, |
56 width, | |
57 height, | |
58 base::TimeDelta()); | 57 base::TimeDelta()); |
59 long bytes_read = | 58 long bytes_read = |
60 fread(video_frame->data(0), 1, frame_size, file_handle); | 59 fread(video_frame->data(0), 1, frame_size, file_handle); |
61 | 60 |
62 if (bytes_read != frame_size) { | 61 if (bytes_read != frame_size) { |
63 printf("Could not read %s\n", file_name.c_str()); | 62 printf("Could not read %s\n", file_name.c_str()); |
64 fclose(file_handle); | 63 fclose(file_handle); |
65 exit(1); | 64 exit(1); |
66 } | 65 } |
67 out_frames.push_back(video_frame); | 66 out_frames.push_back(video_frame); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 scoped_ptr<GPUPainter> painter(painters[i].painter); | 153 scoped_ptr<GPUPainter> painter(painters[i].painter); |
155 painter->LoadFrames(&frames); | 154 painter->LoadFrames(&frames); |
156 painter->SetGLContext(surface, context); | 155 painter->SetGLContext(surface, context); |
157 painter->Initialize(width, height); | 156 painter->Initialize(width, height); |
158 printf("Running %s tests...", painters[i].name); | 157 printf("Running %s tests...", painters[i].name); |
159 RunTest(window.get(), painter.get()); | 158 RunTest(window.get(), painter.get()); |
160 } | 159 } |
161 | 160 |
162 return 0; | 161 return 0; |
163 } | 162 } |
OLD | NEW |