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

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

Issue 1942123002: Plumb decoded video pixel format from GPU process to renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 #include <climits> 8 #include <climits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 return nullptr; 178 return nullptr;
179 } 179 }
180 180
181 gpu::MailboxHolder mailbox_holders[kMaxPlanes]; 181 gpu::MailboxHolder mailbox_holders[kMaxPlanes];
182 mailbox_holders[kARGBPlane] = mailbox_holder; 182 mailbox_holders[kARGBPlane] = mailbox_holder;
183 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size, 183 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size,
184 mailbox_holders, mailbox_holder_release_cb, timestamp); 184 mailbox_holders, mailbox_holder_release_cb, timestamp);
185 } 185 }
186 186
187 // static 187 // static
188 scoped_refptr<VideoFrame> VideoFrame::WrapNativeTextures(
189 VideoPixelFormat format,
190 const gpu::MailboxHolder (&mailbox_holders)[kMaxPlanes],
191 const ReleaseMailboxCB& mailbox_holder_release_cb,
192 const gfx::Size& coded_size,
193 const gfx::Rect& visible_rect,
194 const gfx::Size& natural_size,
195 base::TimeDelta timestamp) {
196 if (format != PIXEL_FORMAT_ARGB && format != PIXEL_FORMAT_XRGB &&
197 format != PIXEL_FORMAT_UYVY && format != PIXEL_FORMAT_NV12) {
198 LOG(DFATAL) << "Unsupported pixel format supported, got "
199 << VideoPixelFormatToString(format);
200 return nullptr;
201 }
202 const StorageType storage = STORAGE_OPAQUE;
203 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) {
204 LOG(DFATAL) << __FUNCTION__ << " Invalid config."
205 << ConfigToString(format, storage, coded_size, visible_rect,
206 natural_size);
207 return nullptr;
208 }
209
210 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size,
211 mailbox_holders, mailbox_holder_release_cb, timestamp);
212 }
213
214 // static
188 scoped_refptr<VideoFrame> VideoFrame::WrapYUV420NativeTextures( 215 scoped_refptr<VideoFrame> VideoFrame::WrapYUV420NativeTextures(
189 const gpu::MailboxHolder& y_mailbox_holder, 216 const gpu::MailboxHolder& y_mailbox_holder,
190 const gpu::MailboxHolder& u_mailbox_holder, 217 const gpu::MailboxHolder& u_mailbox_holder,
191 const gpu::MailboxHolder& v_mailbox_holder, 218 const gpu::MailboxHolder& v_mailbox_holder,
192 const ReleaseMailboxCB& mailbox_holder_release_cb, 219 const ReleaseMailboxCB& mailbox_holder_release_cb,
193 const gfx::Size& coded_size, 220 const gfx::Size& coded_size,
194 const gfx::Rect& visible_rect, 221 const gfx::Rect& visible_rect,
195 const gfx::Size& natural_size, 222 const gfx::Size& natural_size,
196 base::TimeDelta timestamp) { 223 base::TimeDelta timestamp) {
197 const StorageType storage = STORAGE_OPAQUE; 224 const StorageType storage = STORAGE_OPAQUE;
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 if (zero_initialize_memory) 1138 if (zero_initialize_memory)
1112 memset(data, 0, data_size); 1139 memset(data, 0, data_size);
1113 1140
1114 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1141 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1115 data_[plane] = data + offset[plane]; 1142 data_[plane] = data + offset[plane];
1116 1143
1117 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1144 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1118 } 1145 }
1119 1146
1120 } // namespace media 1147 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698