OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (fwrite(buf, 1, width, file) != static_cast<unsigned int>(width)) | 99 if (fwrite(buf, 1, width, file) != static_cast<unsigned int>(width)) |
100 return -1; | 100 return -1; |
101 } | 101 } |
102 return 0; | 102 return 0; |
103 } | 103 } |
104 | 104 |
105 // TODO(nisse): Belongs with the test code? | 105 // TODO(nisse): Belongs with the test code? |
106 int PrintVideoFrame(const VideoFrame& frame, FILE* file) { | 106 int PrintVideoFrame(const VideoFrame& frame, FILE* file) { |
107 if (file == NULL) | 107 if (file == NULL) |
108 return -1; | 108 return -1; |
109 if (frame.IsZeroSize()) | 109 |
110 return -1; | |
111 int width = frame.video_frame_buffer()->width(); | 110 int width = frame.video_frame_buffer()->width(); |
112 int height = frame.video_frame_buffer()->height(); | 111 int height = frame.video_frame_buffer()->height(); |
113 int chroma_width = (width + 1) / 2; | 112 int chroma_width = (width + 1) / 2; |
114 int chroma_height = (height + 1) / 2; | 113 int chroma_height = (height + 1) / 2; |
115 | 114 |
116 if (PrintPlane(frame.video_frame_buffer()->DataY(), width, height, | 115 if (PrintPlane(frame.video_frame_buffer()->DataY(), width, height, |
117 frame.video_frame_buffer()->StrideY(), file) < 0) { | 116 frame.video_frame_buffer()->StrideY(), file) < 0) { |
118 return -1; | 117 return -1; |
119 } | 118 } |
120 if (PrintPlane(frame.video_frame_buffer()->DataU(), | 119 if (PrintPlane(frame.video_frame_buffer()->DataU(), |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 ref_frame->video_frame_buffer()->StrideV(), | 334 ref_frame->video_frame_buffer()->StrideV(), |
336 test_frame->video_frame_buffer()->DataY(), | 335 test_frame->video_frame_buffer()->DataY(), |
337 test_frame->video_frame_buffer()->StrideY(), | 336 test_frame->video_frame_buffer()->StrideY(), |
338 test_frame->video_frame_buffer()->DataU(), | 337 test_frame->video_frame_buffer()->DataU(), |
339 test_frame->video_frame_buffer()->StrideU(), | 338 test_frame->video_frame_buffer()->StrideU(), |
340 test_frame->video_frame_buffer()->DataV(), | 339 test_frame->video_frame_buffer()->DataV(), |
341 test_frame->video_frame_buffer()->StrideV(), | 340 test_frame->video_frame_buffer()->StrideV(), |
342 test_frame->width(), test_frame->height()); | 341 test_frame->width(), test_frame->height()); |
343 } | 342 } |
344 } // namespace webrtc | 343 } // namespace webrtc |
OLD | NEW |