OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 // static | 230 // static |
231 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( | 231 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( |
232 VideoPixelFormat format, | 232 VideoPixelFormat format, |
233 const gpu::MailboxHolder& mailbox_holder, | 233 const gpu::MailboxHolder& mailbox_holder, |
234 const ReleaseMailboxCB& mailbox_holder_release_cb, | 234 const ReleaseMailboxCB& mailbox_holder_release_cb, |
235 const gfx::Size& coded_size, | 235 const gfx::Size& coded_size, |
236 const gfx::Rect& visible_rect, | 236 const gfx::Rect& visible_rect, |
237 const gfx::Size& natural_size, | 237 const gfx::Size& natural_size, |
238 base::TimeDelta timestamp) { | 238 base::TimeDelta timestamp) { |
239 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_UYVY) { | 239 if (format != PIXEL_FORMAT_ARGB && |
| 240 format != PIXEL_FORMAT_UYVY && |
| 241 format != PIXEL_FORMAT_NV12) { |
240 DLOG(ERROR) << "Unsupported pixel format supported, got " | 242 DLOG(ERROR) << "Unsupported pixel format supported, got " |
241 << VideoPixelFormatToString(format); | 243 << VideoPixelFormatToString(format); |
242 return nullptr; | 244 return nullptr; |
243 } | 245 } |
244 const StorageType storage = STORAGE_OPAQUE; | 246 const StorageType storage = STORAGE_OPAQUE; |
245 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 247 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
246 DLOG(ERROR) << __FUNCTION__ << " Invalid config." | 248 DLOG(ERROR) << __FUNCTION__ << " Invalid config." |
247 << ConfigToString(format, storage, coded_size, visible_rect, | 249 << ConfigToString(format, storage, coded_size, visible_rect, |
248 natural_size); | 250 natural_size); |
249 return nullptr; | 251 return nullptr; |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 uint8* data = reinterpret_cast<uint8*>( | 927 uint8* data = reinterpret_cast<uint8*>( |
926 base::AlignedAlloc(data_size, kFrameAddressAlignment)); | 928 base::AlignedAlloc(data_size, kFrameAddressAlignment)); |
927 | 929 |
928 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 930 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
929 data_[plane] = data + offset[plane]; | 931 data_[plane] = data + offset[plane]; |
930 | 932 |
931 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 933 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
932 } | 934 } |
933 | 935 |
934 } // namespace media | 936 } // namespace media |
OLD | NEW |