Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: media/base/video_frame.cc

Issue 1316493004: Add support for converting I420 software frames into NV12 hardware frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@snapshot
Patch Set: Fix win_x64 build Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 // static 217 // static
218 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture( 218 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTexture(
219 VideoPixelFormat format, 219 VideoPixelFormat format,
220 const gpu::MailboxHolder& mailbox_holder, 220 const gpu::MailboxHolder& mailbox_holder,
221 const ReleaseMailboxCB& mailbox_holder_release_cb, 221 const ReleaseMailboxCB& mailbox_holder_release_cb,
222 const gfx::Size& coded_size, 222 const gfx::Size& coded_size,
223 const gfx::Rect& visible_rect, 223 const gfx::Rect& visible_rect,
224 const gfx::Size& natural_size, 224 const gfx::Size& natural_size,
225 base::TimeDelta timestamp) { 225 base::TimeDelta timestamp) {
226 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_UYVY) { 226 if (format != PIXEL_FORMAT_ARGB &&
227 format != PIXEL_FORMAT_UYVY &&
228 format != PIXEL_FORMAT_NV12) {
Daniele Castagna 2015/08/25 15:08:42 You need to add the same to the DCHECK in media/bl
Andre 2015/08/25 18:19:57 I'm not sure how to deal with it there, let me loo
227 DLOG(ERROR) << "Unsupported pixel format supported, got " 229 DLOG(ERROR) << "Unsupported pixel format supported, got "
228 << VideoPixelFormatToString(format); 230 << VideoPixelFormatToString(format);
229 return nullptr; 231 return nullptr;
230 } 232 }
231 const StorageType storage = STORAGE_OPAQUE; 233 const StorageType storage = STORAGE_OPAQUE;
232 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { 234 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) {
233 DLOG(ERROR) << __FUNCTION__ << " Invalid config." 235 DLOG(ERROR) << __FUNCTION__ << " Invalid config."
234 << ConfigToString(format, storage, coded_size, visible_rect, 236 << ConfigToString(format, storage, coded_size, visible_rect,
235 natural_size); 237 natural_size);
236 return nullptr; 238 return nullptr;
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 uint8* data = reinterpret_cast<uint8*>( 909 uint8* data = reinterpret_cast<uint8*>(
908 base::AlignedAlloc(data_size, kFrameAddressAlignment)); 910 base::AlignedAlloc(data_size, kFrameAddressAlignment));
909 911
910 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 912 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
911 data_[plane] = data + offset[plane]; 913 data_[plane] = data + offset[plane];
912 914
913 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 915 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
914 } 916 }
915 917
916 } // namespace media 918 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698