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

Side by Side Diff: webrtc/test/frame_generator_unittest.cc

Issue 1983583002: Revert of Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « webrtc/test/frame_generator.cc ('k') | webrtc/video/video_capture_input_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 fwrite(plane_buffer.get(), 1, y_size, file); 52 fwrite(plane_buffer.get(), 1, y_size, file);
53 memset(plane_buffer.get(), u, uv_size); 53 memset(plane_buffer.get(), u, uv_size);
54 fwrite(plane_buffer.get(), 1, uv_size, file); 54 fwrite(plane_buffer.get(), 1, uv_size, file);
55 memset(plane_buffer.get(), v, uv_size); 55 memset(plane_buffer.get(), v, uv_size);
56 fwrite(plane_buffer.get(), 1, uv_size, file); 56 fwrite(plane_buffer.get(), 1, uv_size, file);
57 } 57 }
58 58
59 void CheckFrameAndMutate(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v) { 59 void CheckFrameAndMutate(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v) {
60 // Check that frame is valid, has the correct color and timestamp are clean. 60 // Check that frame is valid, has the correct color and timestamp are clean.
61 ASSERT_NE(nullptr, frame); 61 ASSERT_NE(nullptr, frame);
62 const uint8_t* buffer; 62 uint8_t* buffer;
63 ASSERT_EQ(y_size, frame->allocated_size(PlaneType::kYPlane)); 63 ASSERT_EQ(y_size, frame->allocated_size(PlaneType::kYPlane));
64 buffer = frame->video_frame_buffer()->DataY(); 64 buffer = frame->buffer(PlaneType::kYPlane);
65 for (int i = 0; i < y_size; ++i) 65 for (int i = 0; i < y_size; ++i)
66 ASSERT_EQ(y, buffer[i]); 66 ASSERT_EQ(y, buffer[i]);
67 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kUPlane)); 67 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kUPlane));
68 buffer = frame->video_frame_buffer()->DataU(); 68 buffer = frame->buffer(PlaneType::kUPlane);
69 for (int i = 0; i < uv_size; ++i) 69 for (int i = 0; i < uv_size; ++i)
70 ASSERT_EQ(u, buffer[i]); 70 ASSERT_EQ(u, buffer[i]);
71 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kVPlane)); 71 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kVPlane));
72 buffer = frame->video_frame_buffer()->DataV(); 72 buffer = frame->buffer(PlaneType::kVPlane);
73 for (int i = 0; i < uv_size; ++i) 73 for (int i = 0; i < uv_size; ++i)
74 ASSERT_EQ(v, buffer[i]); 74 ASSERT_EQ(v, buffer[i]);
75 EXPECT_EQ(0, frame->ntp_time_ms()); 75 EXPECT_EQ(0, frame->ntp_time_ms());
76 EXPECT_EQ(0, frame->render_time_ms()); 76 EXPECT_EQ(0, frame->render_time_ms());
77 EXPECT_EQ(0u, frame->timestamp()); 77 EXPECT_EQ(0u, frame->timestamp());
78 78
79 // Mutate to something arbitrary non-zero. 79 // Mutate to something arbitrary non-zero.
80 frame->set_ntp_time_ms(11); 80 frame->set_ntp_time_ms(11);
81 frame->set_render_time_ms(12); 81 frame->set_render_time_ms(12);
82 frame->set_timestamp(13); 82 frame->set_timestamp(13);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); 141 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0);
142 for (int i = 0; i < kRepeatCount; ++i) 142 for (int i = 0; i < kRepeatCount; ++i)
143 CheckFrameAndMutate(generator->NextFrame(), 127, 127, 127); 143 CheckFrameAndMutate(generator->NextFrame(), 127, 127, 127);
144 for (int i = 0; i < kRepeatCount; ++i) 144 for (int i = 0; i < kRepeatCount; ++i)
145 CheckFrameAndMutate(generator->NextFrame(), 255, 255, 255); 145 CheckFrameAndMutate(generator->NextFrame(), 255, 255, 255);
146 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); 146 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0);
147 } 147 }
148 148
149 } // namespace test 149 } // namespace test
150 } // namespace webrtc 150 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/frame_generator.cc ('k') | webrtc/video/video_capture_input_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698