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

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

Issue 1869303004: media: Implement zero-copy video playback for VP8. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: optimize only VP8 Created 4 years, 8 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
« no previous file with comments | « media/base/video_frame.h ('k') | media/filters/vpx_video_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 gpu::MailboxHolder mailbox_holders[kMaxPlanes]; 206 gpu::MailboxHolder mailbox_holders[kMaxPlanes];
207 mailbox_holders[kYPlane] = y_mailbox_holder; 207 mailbox_holders[kYPlane] = y_mailbox_holder;
208 mailbox_holders[kUPlane] = u_mailbox_holder; 208 mailbox_holders[kUPlane] = u_mailbox_holder;
209 mailbox_holders[kVPlane] = v_mailbox_holder; 209 mailbox_holders[kVPlane] = v_mailbox_holder;
210 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size, 210 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size,
211 mailbox_holders, mailbox_holder_release_cb, timestamp); 211 mailbox_holders, mailbox_holder_release_cb, timestamp);
212 } 212 }
213 213
214 // static 214 // static
215 scoped_refptr<VideoFrame> VideoFrame::WrapYV12ANativeTextures(
216 const gpu::MailboxHolder& y_mailbox_holder,
217 const gpu::MailboxHolder& u_mailbox_holder,
218 const gpu::MailboxHolder& v_mailbox_holder,
219 const gpu::MailboxHolder& a_mailbox_holder,
220 const ReleaseMailboxCB& mailbox_holder_release_cb,
221 const gfx::Size& coded_size,
222 const gfx::Rect& visible_rect,
223 const gfx::Size& natural_size,
224 base::TimeDelta timestamp) {
225 const StorageType storage = STORAGE_OPAQUE;
226 VideoPixelFormat format = PIXEL_FORMAT_YV12A;
227 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) {
228 LOG(DFATAL) << __FUNCTION__ << " Invalid config."
229 << ConfigToString(format, storage, coded_size, visible_rect,
230 natural_size);
231 return nullptr;
232 }
233
234 gpu::MailboxHolder mailbox_holders[kMaxPlanes];
235 mailbox_holders[kYPlane] = y_mailbox_holder;
236 mailbox_holders[kUPlane] = u_mailbox_holder;
237 mailbox_holders[kVPlane] = v_mailbox_holder;
238 mailbox_holders[kAPlane] = a_mailbox_holder;
239 return new VideoFrame(format, storage, coded_size, visible_rect, natural_size,
240 mailbox_holders, mailbox_holder_release_cb, timestamp);
241 }
242
243 // static
215 scoped_refptr<VideoFrame> VideoFrame::WrapExternalData( 244 scoped_refptr<VideoFrame> VideoFrame::WrapExternalData(
216 VideoPixelFormat format, 245 VideoPixelFormat format,
217 const gfx::Size& coded_size, 246 const gfx::Size& coded_size,
218 const gfx::Rect& visible_rect, 247 const gfx::Rect& visible_rect,
219 const gfx::Size& natural_size, 248 const gfx::Size& natural_size,
220 uint8_t* data, 249 uint8_t* data,
221 size_t data_size, 250 size_t data_size,
222 base::TimeDelta timestamp) { 251 base::TimeDelta timestamp) {
223 return WrapExternalStorage(format, STORAGE_UNOWNED_MEMORY, coded_size, 252 return WrapExternalStorage(format, STORAGE_UNOWNED_MEMORY, coded_size,
224 visible_rect, natural_size, data, data_size, 253 visible_rect, natural_size, data, data_size,
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 if (zero_initialize_memory) 1144 if (zero_initialize_memory)
1116 memset(data, 0, data_size); 1145 memset(data, 0, data_size);
1117 1146
1118 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1147 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1119 data_[plane] = data + offset[plane]; 1148 data_[plane] = data + offset[plane];
1120 1149
1121 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1150 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1122 } 1151 }
1123 1152
1124 } // namespace media 1153 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | media/filters/vpx_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698