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 #include <climits> | 8 #include <climits> |
9 | 9 |
10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // static | 195 // static |
196 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTextures( | 196 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTextures( |
197 VideoPixelFormat format, | 197 VideoPixelFormat format, |
198 const gpu::MailboxHolder (&mailbox_holders)[kMaxPlanes], | 198 const gpu::MailboxHolder (&mailbox_holders)[kMaxPlanes], |
199 const ReleaseMailboxCB& mailbox_holder_release_cb, | 199 const ReleaseMailboxCB& mailbox_holder_release_cb, |
200 const gfx::Size& coded_size, | 200 const gfx::Size& coded_size, |
201 const gfx::Rect& visible_rect, | 201 const gfx::Rect& visible_rect, |
202 const gfx::Size& natural_size, | 202 const gfx::Size& natural_size, |
203 base::TimeDelta timestamp) { | 203 base::TimeDelta timestamp) { |
204 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_XRGB && | 204 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_XRGB && |
205 format != PIXEL_FORMAT_UYVY && format != PIXEL_FORMAT_NV12 && | 205 format != PIXEL_FORMAT_UYVY && format != PIXEL_FORMAT_YUY2 && |
206 format != PIXEL_FORMAT_I420) { | 206 format != PIXEL_FORMAT_NV12 && format != PIXEL_FORMAT_I420) { |
207 LOG(DFATAL) << "Unsupported pixel format supported, got " | 207 LOG(DFATAL) << "Unsupported pixel format supported, got " |
208 << VideoPixelFormatToString(format); | 208 << VideoPixelFormatToString(format); |
209 return nullptr; | 209 return nullptr; |
210 } | 210 } |
211 const StorageType storage = STORAGE_OPAQUE; | 211 const StorageType storage = STORAGE_OPAQUE; |
212 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { | 212 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
213 LOG(DFATAL) << __func__ << " Invalid config." | 213 LOG(DFATAL) << __func__ << " Invalid config." |
214 << ConfigToString(format, storage, coded_size, visible_rect, | 214 << ConfigToString(format, storage, coded_size, visible_rect, |
215 natural_size); | 215 natural_size); |
216 return nullptr; | 216 return nullptr; |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 if (zero_initialize_memory) | 1152 if (zero_initialize_memory) |
1153 memset(data, 0, data_size); | 1153 memset(data, 0, data_size); |
1154 | 1154 |
1155 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) | 1155 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) |
1156 data_[plane] = data + offset[plane]; | 1156 data_[plane] = data + offset[plane]; |
1157 | 1157 |
1158 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); | 1158 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); |
1159 } | 1159 } |
1160 | 1160 |
1161 } // namespace media | 1161 } // namespace media |
OLD | NEW |