| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 const uint8_t* buffer; |
| 63 ASSERT_EQ(y_size, frame->allocated_size(PlaneType::kYPlane)); | |
| 64 buffer = frame->video_frame_buffer()->DataY(); | 63 buffer = frame->video_frame_buffer()->DataY(); |
| 65 for (int i = 0; i < y_size; ++i) | 64 for (int i = 0; i < y_size; ++i) |
| 66 ASSERT_EQ(y, buffer[i]); | 65 ASSERT_EQ(y, buffer[i]); |
| 67 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kUPlane)); | |
| 68 buffer = frame->video_frame_buffer()->DataU(); | 66 buffer = frame->video_frame_buffer()->DataU(); |
| 69 for (int i = 0; i < uv_size; ++i) | 67 for (int i = 0; i < uv_size; ++i) |
| 70 ASSERT_EQ(u, buffer[i]); | 68 ASSERT_EQ(u, buffer[i]); |
| 71 ASSERT_EQ(uv_size, frame->allocated_size(PlaneType::kVPlane)); | |
| 72 buffer = frame->video_frame_buffer()->DataV(); | 69 buffer = frame->video_frame_buffer()->DataV(); |
| 73 for (int i = 0; i < uv_size; ++i) | 70 for (int i = 0; i < uv_size; ++i) |
| 74 ASSERT_EQ(v, buffer[i]); | 71 ASSERT_EQ(v, buffer[i]); |
| 75 EXPECT_EQ(0, frame->ntp_time_ms()); | 72 EXPECT_EQ(0, frame->ntp_time_ms()); |
| 76 EXPECT_EQ(0, frame->render_time_ms()); | 73 EXPECT_EQ(0, frame->render_time_ms()); |
| 77 EXPECT_EQ(0u, frame->timestamp()); | 74 EXPECT_EQ(0u, frame->timestamp()); |
| 78 | 75 |
| 79 // Mutate to something arbitrary non-zero. | 76 // Mutate to something arbitrary non-zero. |
| 80 frame->set_ntp_time_ms(11); | 77 frame->set_ntp_time_ms(11); |
| 81 frame->set_render_time_ms(12); | 78 frame->set_render_time_ms(12); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); | 138 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); |
| 142 for (int i = 0; i < kRepeatCount; ++i) | 139 for (int i = 0; i < kRepeatCount; ++i) |
| 143 CheckFrameAndMutate(generator->NextFrame(), 127, 127, 127); | 140 CheckFrameAndMutate(generator->NextFrame(), 127, 127, 127); |
| 144 for (int i = 0; i < kRepeatCount; ++i) | 141 for (int i = 0; i < kRepeatCount; ++i) |
| 145 CheckFrameAndMutate(generator->NextFrame(), 255, 255, 255); | 142 CheckFrameAndMutate(generator->NextFrame(), 255, 255, 255); |
| 146 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); | 143 CheckFrameAndMutate(generator->NextFrame(), 0, 0, 0); |
| 147 } | 144 } |
| 148 | 145 |
| 149 } // namespace test | 146 } // namespace test |
| 150 } // namespace webrtc | 147 } // namespace webrtc |
| OLD | NEW |