OLD | NEW |
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 fwrite(plane_buffer.get(), 1, y_size, file); | 51 fwrite(plane_buffer.get(), 1, y_size, file); |
52 memset(plane_buffer.get(), u, uv_size); | 52 memset(plane_buffer.get(), u, uv_size); |
53 fwrite(plane_buffer.get(), 1, uv_size, file); | 53 fwrite(plane_buffer.get(), 1, uv_size, file); |
54 memset(plane_buffer.get(), v, uv_size); | 54 memset(plane_buffer.get(), v, uv_size); |
55 fwrite(plane_buffer.get(), 1, uv_size, file); | 55 fwrite(plane_buffer.get(), 1, uv_size, file); |
56 } | 56 } |
57 | 57 |
58 void CheckFrameAndMutate(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v) { | 58 void CheckFrameAndMutate(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v) { |
59 // Check that frame is valid, has the correct color and timestamp are clean. | 59 // Check that frame is valid, has the correct color and timestamp are clean. |
60 ASSERT_NE(nullptr, frame); | 60 ASSERT_NE(nullptr, frame); |
61 const uint8_t* buffer; | 61 uint8_t* buffer; |
62 ASSERT_EQ(y_size, frame->allocated_size(PlaneType::kYPlane)); | 62 ASSERT_EQ(y_size, frame->allocated_size(PlaneType::kYPlane)); |
63 buffer = frame->video_frame_buffer()->DataY(); | 63 buffer = frame->buffer(PlaneType::kYPlane); |
64 for (int i = 0; i < y_size; ++i) | 64 for (int i = 0; i < y_size; ++i) |
65 ASSERT_EQ(y, buffer[i]); | 65 ASSERT_EQ(y, buffer[i]); |
66 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kUPlane)); | 66 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kUPlane)); |
67 buffer = frame->video_frame_buffer()->DataU(); | 67 buffer = frame->buffer(PlaneType::kUPlane); |
68 for (int i = 0; i < uv_size; ++i) | 68 for (int i = 0; i < uv_size; ++i) |
69 ASSERT_EQ(u, buffer[i]); | 69 ASSERT_EQ(u, buffer[i]); |
70 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kVPlane)); | 70 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kVPlane)); |
71 buffer = frame->video_frame_buffer()->DataV(); | 71 buffer = frame->buffer(PlaneType::kVPlane); |
72 for (int i = 0; i < uv_size; ++i) | 72 for (int i = 0; i < uv_size; ++i) |
73 ASSERT_EQ(v, buffer[i]); | 73 ASSERT_EQ(v, buffer[i]); |
74 EXPECT_EQ(0, frame->ntp_time_ms()); | 74 EXPECT_EQ(0, frame->ntp_time_ms()); |
75 EXPECT_EQ(0, frame->render_time_ms()); | 75 EXPECT_EQ(0, frame->render_time_ms()); |
76 EXPECT_EQ(0u, frame->timestamp()); | 76 EXPECT_EQ(0u, frame->timestamp()); |
77 | 77 |
78 // Mutate to something arbitrary non-zero. | 78 // Mutate to something arbitrary non-zero. |
79 frame->set_ntp_time_ms(11); | 79 frame->set_ntp_time_ms(11); |
80 frame->set_render_time_ms(12); | 80 frame->set_render_time_ms(12); |
81 frame->set_timestamp(13); | 81 frame->set_timestamp(13); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); | 140 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); |
141 for (int i = 0; i < kRepeatCount; ++i) | 141 for (int i = 0; i < kRepeatCount; ++i) |
142 CheckFrameAndMutate(generator->NextFrame(), 127, 127, 127); | 142 CheckFrameAndMutate(generator->NextFrame(), 127, 127, 127); |
143 for (int i = 0; i < kRepeatCount; ++i) | 143 for (int i = 0; i < kRepeatCount; ++i) |
144 CheckFrameAndMutate(generator->NextFrame(), 255, 255, 255); | 144 CheckFrameAndMutate(generator->NextFrame(), 255, 255, 255); |
145 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); | 145 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); |
146 } | 146 } |
147 | 147 |
148 } // namespace test | 148 } // namespace test |
149 } // namespace webrtc | 149 } // namespace webrtc |
OLD | NEW |