| 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 && | 239 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_UYVY) { |
| 240 format != PIXEL_FORMAT_UYVY && | |
| 241 format != PIXEL_FORMAT_NV12) { | |
| 242 DLOG(ERROR) << "Unsupported pixel format supported, got " | 240 DLOG(ERROR) << "Unsupported pixel format supported, got " |
| 243 << VideoPixelFormatToString(format); | 241 << VideoPixelFormatToString(format); |
| 244 return nullptr; | 242 return nullptr; |
| 245 } | 243 } |
| 246 const StorageType storage = STORAGE_OPAQUE; | 244 const StorageType storage = STORAGE_OPAQUE; |
| 247 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 245 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
| 248 DLOG(ERROR) << __FUNCTION__ << " Invalid config." | 246 DLOG(ERROR) << __FUNCTION__ << " Invalid config." |
| 249 << ConfigToString(format, storage, coded_size, visible_rect, | 247 << ConfigToString(format, storage, coded_size, visible_rect, |
| 250 natural_size); | 248 natural_size); |
| 251 return nullptr; | 249 return nullptr; |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 uint8* data = reinterpret_cast<uint8*>( | 925 uint8* data = reinterpret_cast<uint8*>( |
| 928 base::AlignedAlloc(data_size, kFrameAddressAlignment)); | 926 base::AlignedAlloc(data_size, kFrameAddressAlignment)); |
| 929 | 927 |
| 930 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 928 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
| 931 data_[plane] = data + offset[plane]; | 929 data_[plane] = data + offset[plane]; |
| 932 | 930 |
| 933 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 931 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
| 934 } | 932 } |
| 935 | 933 |
| 936 } // namespace media | 934 } // namespace media |
| OLD | NEW |