OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "media/base/video_frame.h" | 5 #include "media/base/video_frame.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "media/base/buffers.h" | 9 #include "media/base/buffers.h" |
10 #include "media/base/mock_filters.h" | 10 #include "media/base/mock_filters.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 private_buffer, &frame); | 188 private_buffer, &frame); |
189 ASSERT_TRUE(frame); | 189 ASSERT_TRUE(frame); |
190 | 190 |
191 // Test |frame| properties. | 191 // Test |frame| properties. |
192 EXPECT_EQ(media::VideoFrame::TYPE_EGL_IMAGE, frame->type()); | 192 EXPECT_EQ(media::VideoFrame::TYPE_EGL_IMAGE, frame->type()); |
193 EXPECT_EQ(media::VideoFrame::RGBA, frame->format()); | 193 EXPECT_EQ(media::VideoFrame::RGBA, frame->format()); |
194 EXPECT_EQ(private_buffer, frame->private_buffer()); | 194 EXPECT_EQ(private_buffer, frame->private_buffer()); |
195 EXPECT_EQ(NULL, frame->data(VideoFrame::kYPlane)); | 195 EXPECT_EQ(NULL, frame->data(VideoFrame::kYPlane)); |
196 } | 196 } |
197 | 197 |
| 198 TEST(VideoFram, CreateExternalFrame) { |
| 199 scoped_array<uint8> memory(new uint8[1]); |
| 200 |
| 201 scoped_refptr<media::VideoFrame> frame; |
| 202 uint8* data[3] = {memory.get(), NULL, NULL}; |
| 203 int strides[3] = {1, 0, 0}; |
| 204 VideoFrame::CreateFrameExternal(media::VideoFrame::RGB32, 0, 0, |
| 205 data, strides, |
| 206 base::TimeDelta(), base::TimeDelta(), &frame); |
| 207 ASSERT_TRUE(frame); |
| 208 |
| 209 // Test frame properties. |
| 210 EXPECT_EQ(1, frame->stride(VideoFrame::kRGBPlane)); |
| 211 EXPECT_EQ(memory.get(), frame->data(VideoFrame::kRGBPlane)); |
| 212 |
| 213 // Delete |memory| and then |frame|. |
| 214 memory.reset(); |
| 215 frame = NULL; |
| 216 } |
| 217 |
198 } // namespace media | 218 } // namespace media |
OLD | NEW |