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

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

Issue 1306693002: media: Convert I420 VideoFrame to UYVY GpuMemoryBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Address andresantoso's comments. 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) { 226 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_UYVY) {
reveman 2015/08/21 21:53:03 why does this change?
Daniele Castagna 2015/08/21 22:46:04 We need to send a VideoFrame that contains one mai
reveman 2015/08/22 14:04:46 don't we sample out of this texture as if it was A
227 DLOG(ERROR) << "Only ARGB pixel format supported, got " 227 DLOG(ERROR) << "Unsupported pixel format supported, got "
228 << VideoPixelFormatToString(format); 228 << VideoPixelFormatToString(format);
229 return nullptr; 229 return nullptr;
230 } 230 }
231 const StorageType storage = STORAGE_OPAQUE; 231 const StorageType storage = STORAGE_OPAQUE;
232 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { 232 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) {
233 DLOG(ERROR) << __FUNCTION__ << " Invalid config." 233 DLOG(ERROR) << __FUNCTION__ << " Invalid config."
234 << ConfigToString(format, storage, coded_size, visible_rect, 234 << ConfigToString(format, storage, coded_size, visible_rect,
235 natural_size); 235 natural_size);
236 return nullptr; 236 return nullptr;
237 } 237 }
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 uint8* data = reinterpret_cast<uint8*>( 907 uint8* data = reinterpret_cast<uint8*>(
908 base::AlignedAlloc(data_size, kFrameAddressAlignment)); 908 base::AlignedAlloc(data_size, kFrameAddressAlignment));
909 909
910 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 910 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
911 data_[plane] = data + offset[plane]; 911 data_[plane] = data + offset[plane];
912 912
913 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 913 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
914 } 914 }
915 915
916 } // namespace media 916 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698