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

Side by Side Diff: media/video/gpu_memory_buffer_video_frame_pool.cc

Issue 1307853003: Add support for converting I420 software frames into NV12 hardware frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@biplanar
Patch Set: Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/video/gpu_memory_buffer_video_frame_pool.h" 5 #include "media/video/gpu_memory_buffer_video_frame_pool.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // output size is |kBytesPerCopyTarget| bytes and run in parallel. 153 // output size is |kBytesPerCopyTarget| bytes and run in parallel.
154 const size_t kBytesPerCopyTarget = 1024 * 1024; // 1MB 154 const size_t kBytesPerCopyTarget = 1024 * 1024; // 1MB
155 155
156 // Return the GpuMemoryBuffer format to use for a specific VideoPixelFormat 156 // Return the GpuMemoryBuffer format to use for a specific VideoPixelFormat
157 // and plane. 157 // and plane.
158 gfx::BufferFormat GpuMemoryBufferFormat(VideoPixelFormat format, size_t plane) { 158 gfx::BufferFormat GpuMemoryBufferFormat(VideoPixelFormat format, size_t plane) {
159 switch (format) { 159 switch (format) {
160 case PIXEL_FORMAT_I420: 160 case PIXEL_FORMAT_I420:
161 DCHECK_LE(plane, 2u); 161 DCHECK_LE(plane, 2u);
162 return gfx::BufferFormat::R_8; 162 return gfx::BufferFormat::R_8;
163 case PIXEL_FORMAT_NV12:
164 DCHECK_LE(plane, 1u);
165 return gfx::BufferFormat::YUV_420_BIPLANAR;
163 case PIXEL_FORMAT_UYVY: 166 case PIXEL_FORMAT_UYVY:
164 DCHECK_EQ(0u, plane); 167 DCHECK_EQ(0u, plane);
165 return gfx::BufferFormat::UYVY_422; 168 return gfx::BufferFormat::UYVY_422;
166 default: 169 default:
167 NOTREACHED(); 170 NOTREACHED();
168 return gfx::BufferFormat::BGRA_8888; 171 return gfx::BufferFormat::BGRA_8888;
169 } 172 }
170 } 173 }
171 174
172 unsigned ImageInternalFormat(VideoPixelFormat format, size_t plane) { 175 unsigned ImageInternalFormat(VideoPixelFormat format, size_t plane) {
173 switch (format) { 176 switch (format) {
174 case PIXEL_FORMAT_I420: 177 case PIXEL_FORMAT_I420:
175 DCHECK_LE(plane, 2u); 178 DCHECK_LE(plane, 2u);
176 return GL_R8_EXT; 179 return GL_R8_EXT;
180 case PIXEL_FORMAT_NV12:
181 DCHECK_LE(plane, 1u);
182 return GL_R8_EXT;
Daniele Castagna 2015/08/31 16:28:14 Here we need the new internal format, it should be
Andre 2015/08/31 18:29:31 Great, thanks!
Andre 2015/09/08 20:20:45 dcastagna, I've changed this to NOTREACHED(). Shou
177 case PIXEL_FORMAT_UYVY: 183 case PIXEL_FORMAT_UYVY:
178 DCHECK_EQ(0u, plane); 184 DCHECK_EQ(0u, plane);
179 return GL_RGB; 185 return GL_RGB;
180 default: 186 default:
181 NOTREACHED(); 187 NOTREACHED();
182 return 0; 188 return 0;
183 } 189 }
184 } 190 }
185 191
192 // The number of output planes to be copied in each iteration.
193 size_t PlanesPerCopy(VideoPixelFormat format) {
194 switch (format) {
195 case PIXEL_FORMAT_I420:
196 case PIXEL_FORMAT_UYVY:
197 return 1;
198 case PIXEL_FORMAT_NV12:
199 return 2;
200 default:
201 NOTREACHED();
202 return 0;
203 }
204 }
205
206 // The number of output rows to be copied in each iteration.
207 int RowsPerCopy(size_t plane, VideoPixelFormat format, int width) {
208 int bytes_per_row = VideoFrame::RowBytes(plane, format, width);
209 if (format == PIXEL_FORMAT_NV12) {
210 DCHECK_EQ(0u, plane);
211 bytes_per_row += VideoFrame::RowBytes(1, format, width);
212 }
213 // Copy a even number of lines, and at least one.
Daniele Castagna 2015/08/31 16:28:14 nit: shouldn't it be "an even"
Andre 2015/08/31 18:29:31 Done.
214 return std::max<size_t>((kBytesPerCopyTarget / bytes_per_row) & ~1, 1);
215 }
216
186 void CopyRowsToI420Buffer(int first_row, 217 void CopyRowsToI420Buffer(int first_row,
187 int rows, 218 int rows,
188 int bytes_per_row, 219 int bytes_per_row,
189 const uint8* source, 220 const uint8* source,
190 int source_stride, 221 int source_stride,
191 uint8* output, 222 uint8* output,
192 int dest_stride, 223 int dest_stride,
193 const base::Closure& done) { 224 const base::Closure& done) {
194 TRACE_EVENT2("media", "CopyRowsToI420Buffer", "bytes_per_row", bytes_per_row, 225 TRACE_EVENT2("media", "CopyRowsToI420Buffer", "bytes_per_row", bytes_per_row,
195 "rows", rows); 226 "rows", rows);
196 DCHECK_NE(dest_stride, 0); 227 DCHECK_NE(dest_stride, 0);
197 DCHECK_LE(bytes_per_row, std::abs(dest_stride)); 228 DCHECK_LE(bytes_per_row, std::abs(dest_stride));
198 DCHECK_LE(bytes_per_row, source_stride); 229 DCHECK_LE(bytes_per_row, source_stride);
199 for (int row = first_row; row < first_row + rows; ++row) { 230 for (int row = first_row; row < first_row + rows; ++row) {
200 memcpy(output + dest_stride * row, source + source_stride * row, 231 memcpy(output + dest_stride * row, source + source_stride * row,
201 bytes_per_row); 232 bytes_per_row);
202 } 233 }
203 done.Run(); 234 done.Run();
204 } 235 }
205 236
237 void CopyRowsToNV12Buffer(int first_row,
238 int rows,
239 int bytes_per_row,
240 const scoped_refptr<VideoFrame>& source_frame,
241 uint8* dest_y,
242 int dest_stride_y,
243 uint8* dest_uv,
244 int dest_stride_uv,
245 const base::Closure& done) {
246 TRACE_EVENT2("media", "CopyRowsToNV12Buffer", "bytes_per_row", bytes_per_row,
247 "rows", rows);
248 DCHECK_NE(dest_stride_y, 0);
249 DCHECK_NE(dest_stride_uv, 0);
250 DCHECK_LE(bytes_per_row, std::abs(dest_stride_y));
251 DCHECK_LE(bytes_per_row, std::abs(dest_stride_uv));
252 DCHECK_EQ(0, first_row % 2);
253 libyuv::I420ToNV12(
254 source_frame->data(VideoFrame::kYPlane) +
255 first_row * source_frame->stride(VideoFrame::kYPlane),
256 source_frame->stride(VideoFrame::kYPlane),
257 source_frame->data(VideoFrame::kUPlane) +
258 first_row / 2 * source_frame->stride(VideoFrame::kUPlane),
259 source_frame->stride(VideoFrame::kUPlane),
260 source_frame->data(VideoFrame::kVPlane) +
261 first_row / 2 * source_frame->stride(VideoFrame::kVPlane),
262 source_frame->stride(VideoFrame::kVPlane),
263 dest_y + first_row * dest_stride_y, dest_stride_y,
264 dest_uv + first_row / 2 * dest_stride_uv, dest_stride_uv,
265 bytes_per_row, rows);
266 done.Run();
267 }
268
206 void CopyRowsToUYVYBuffer(int first_row, 269 void CopyRowsToUYVYBuffer(int first_row,
207 int rows, 270 int rows,
208 int width, 271 int width,
209 const scoped_refptr<VideoFrame>& source_frame, 272 const scoped_refptr<VideoFrame>& source_frame,
210 uint8* output, 273 uint8* output,
211 int dest_stride, 274 int dest_stride,
212 const base::Closure& done) { 275 const base::Closure& done) {
213 TRACE_EVENT2("media", "CopyRowsToUYVYBuffer", "bytes_per_row", width * 2, 276 TRACE_EVENT2("media", "CopyRowsToUYVYBuffer", "bytes_per_row", width * 2,
214 "rows", rows); 277 "rows", rows);
215 DCHECK_NE(dest_stride, 0); 278 DCHECK_NE(dest_stride, 0);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 339
277 worker_task_runner_->PostTask( 340 worker_task_runner_->PostTask(
278 FROM_HERE, base::Bind(&PoolImpl::CopyVideoFrameToGpuMemoryBuffers, this, 341 FROM_HERE, base::Bind(&PoolImpl::CopyVideoFrameToGpuMemoryBuffers, this,
279 video_frame, frame_resources, frame_ready_cb)); 342 video_frame, frame_resources, frame_ready_cb));
280 } 343 }
281 344
282 void GpuMemoryBufferVideoFramePool::PoolImpl::OnCopiesDone( 345 void GpuMemoryBufferVideoFramePool::PoolImpl::OnCopiesDone(
283 const scoped_refptr<VideoFrame>& video_frame, 346 const scoped_refptr<VideoFrame>& video_frame,
284 FrameResources* frame_resources, 347 FrameResources* frame_resources,
285 const FrameReadyCB& frame_ready_cb) { 348 const FrameReadyCB& frame_ready_cb) {
286 const size_t planes = VideoFrame::NumPlanes(output_format_); 349 for (const auto& plane_resource : frame_resources->plane_resources) {
287 for (size_t i = 0; i < planes; ++i) { 350 if (plane_resource.gpu_memory_buffer)
288 frame_resources->plane_resources[i].gpu_memory_buffer->Unmap(); 351 plane_resource.gpu_memory_buffer->Unmap();
289 } 352 }
290 353
291 media_task_runner_->PostTask( 354 media_task_runner_->PostTask(
292 FROM_HERE, 355 FROM_HERE,
293 base::Bind(&PoolImpl::BindAndCreateMailboxesHardwareFrameResources, this, 356 base::Bind(&PoolImpl::BindAndCreateMailboxesHardwareFrameResources, this,
294 video_frame, frame_resources, frame_ready_cb)); 357 video_frame, frame_resources, frame_ready_cb));
295 } 358 }
296 359
297 // Copies |video_frame| into |frame_resources| asynchronously, posting n tasks 360 // Copies |video_frame| into |frame_resources| asynchronously, posting n tasks
298 // that will be synchronized by a barrier. 361 // that will be synchronized by a barrier.
299 // After the barrier is passed OnCopiesDone will be called. 362 // After the barrier is passed OnCopiesDone will be called.
300 void GpuMemoryBufferVideoFramePool::PoolImpl::CopyVideoFrameToGpuMemoryBuffers( 363 void GpuMemoryBufferVideoFramePool::PoolImpl::CopyVideoFrameToGpuMemoryBuffers(
301 const scoped_refptr<VideoFrame>& video_frame, 364 const scoped_refptr<VideoFrame>& video_frame,
302 FrameResources* frame_resources, 365 FrameResources* frame_resources,
303 const FrameReadyCB& frame_ready_cb) { 366 const FrameReadyCB& frame_ready_cb) {
304 // Compute the number of tasks to post and create the barrier. 367 // Compute the number of tasks to post and create the barrier.
305 const size_t dest_planes = VideoFrame::NumPlanes(output_format_); 368 const size_t dest_planes = VideoFrame::NumPlanes(output_format_);
306 gfx::Size size = video_frame->visible_rect().size(); 369 gfx::Size size = video_frame->visible_rect().size();
307 size_t copies = 0; 370 size_t copies = 0;
308 for (size_t i = 0; i < dest_planes; ++i) { 371 for (size_t i = 0; i < dest_planes; i += PlanesPerCopy(output_format_)) {
309 int rows = VideoFrame::Rows(i, output_format_, size.height()); 372 const int rows = VideoFrame::Rows(i, output_format_, size.height());
310 int bytes_per_row = VideoFrame::RowBytes(i, output_format_, size.width()); 373 const int rows_per_copy = RowsPerCopy(i, output_format_, size.width());
311 // Copy a even number of lines, and at least one.
312 int rows_per_copy =
313 std::max<size_t>((kBytesPerCopyTarget / bytes_per_row) & ~1, 1);
314 copies += rows / rows_per_copy; 374 copies += rows / rows_per_copy;
315 if (rows % rows_per_copy) 375 if (rows % rows_per_copy)
316 ++copies; 376 ++copies;
317 } 377 }
318 base::Closure copies_done = 378 base::Closure copies_done =
319 base::Bind(&PoolImpl::OnCopiesDone, this, video_frame, frame_resources, 379 base::Bind(&PoolImpl::OnCopiesDone, this, video_frame, frame_resources,
320 frame_ready_cb); 380 frame_ready_cb);
321 base::Closure barrier = base::BarrierClosure(copies, copies_done); 381 base::Closure barrier = base::BarrierClosure(copies, copies_done);
382
322 // Post all the async tasks. 383 // Post all the async tasks.
323 for (size_t i = 0; i < dest_planes; ++i) { 384 for (size_t i = 0; i < dest_planes; i += PlanesPerCopy(output_format_)) {
324 int rows = VideoFrame::Rows(i, output_format_, size.height()); 385 gfx::GpuMemoryBuffer* buffer =
325 int bytes_per_row = VideoFrame::RowBytes(i, output_format_, size.width()); 386 frame_resources->plane_resources[i].gpu_memory_buffer.get();
326 int rows_per_copy = 387 DCHECK(buffer);
327 std::max<size_t>((kBytesPerCopyTarget / bytes_per_row) & ~1, 1); 388 const size_t buffer_planes =
389 gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat());
390 DCHECK_LE(buffer_planes, VideoFrame::kMaxPlanes);
391 uint8* dest_buffers[VideoFrame::kMaxPlanes];
392 int dest_strides[VideoFrame::kMaxPlanes];
393 bool rv = buffer->Map(reinterpret_cast<void**>(dest_buffers));
394 DCHECK(rv);
395 buffer->GetStride(dest_strides);
328 396
329 void* data = nullptr; 397 const int rows = VideoFrame::Rows(i, output_format_, size.height());
330 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat( 398 const int rows_per_copy = RowsPerCopy(i, output_format_, size.width());
331 GpuMemoryBufferFormat(output_format_, i)));
332 bool rv = frame_resources->plane_resources[i].gpu_memory_buffer->Map(&data);
333 DCHECK(rv);
334 uint8* mapped_buffer = static_cast<uint8*>(data);
335
336 int dest_stride = 0;
337 frame_resources->plane_resources[i].gpu_memory_buffer->GetStride(
338 &dest_stride);
339 399
340 for (int row = 0; row < rows; row += rows_per_copy) { 400 for (int row = 0; row < rows; row += rows_per_copy) {
401 const int rows_to_copy = std::min(rows_per_copy, rows - row);
341 switch (output_format_) { 402 switch (output_format_) {
342 case PIXEL_FORMAT_I420: 403 case PIXEL_FORMAT_I420: {
404 DCHECK_EQ(1u, buffer_planes);
405 const int bytes_per_row =
406 VideoFrame::RowBytes(i, output_format_, size.width());
343 worker_task_runner_->PostTask( 407 worker_task_runner_->PostTask(
344 FROM_HERE, 408 FROM_HERE,
345 base::Bind(&CopyRowsToI420Buffer, row, 409 base::Bind(&CopyRowsToI420Buffer, row, rows_to_copy,
346 std::min(rows_per_copy, rows - row), bytes_per_row, 410 bytes_per_row, video_frame->data(i),
347 video_frame->data(i), video_frame->stride(i), 411 video_frame->stride(i), dest_buffers[0],
348 mapped_buffer, dest_stride, barrier)); 412 dest_strides[0], barrier));
413 break;
414 }
415 case PIXEL_FORMAT_NV12:
416 DCHECK_EQ(2u, buffer_planes);
417 worker_task_runner_->PostTask(
418 FROM_HERE,
419 base::Bind(&CopyRowsToNV12Buffer, row, rows_to_copy,
420 size.width(), video_frame, dest_buffers[0],
421 dest_strides[0], dest_buffers[1], dest_strides[1],
422 barrier));
349 break; 423 break;
350 case PIXEL_FORMAT_UYVY: 424 case PIXEL_FORMAT_UYVY:
425 DCHECK_EQ(1u, buffer_planes);
351 worker_task_runner_->PostTask( 426 worker_task_runner_->PostTask(
352 FROM_HERE, 427 FROM_HERE,
353 base::Bind(&CopyRowsToUYVYBuffer, row, 428 base::Bind(&CopyRowsToUYVYBuffer, row, rows_to_copy, size.width(),
354 std::min(rows_per_copy, rows - row), size.width(), 429 video_frame, dest_buffers[0], dest_strides[0],
355 video_frame, mapped_buffer, dest_stride, barrier)); 430 barrier));
356 break; 431 break;
357 default: 432 default:
358 NOTREACHED(); 433 NOTREACHED();
359 } 434 }
360 } 435 }
361 } 436 }
362 } 437 }
363 438
364 void GpuMemoryBufferVideoFramePool::PoolImpl:: 439 void GpuMemoryBufferVideoFramePool::PoolImpl::
365 BindAndCreateMailboxesHardwareFrameResources( 440 BindAndCreateMailboxesHardwareFrameResources(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 frame = VideoFrame::WrapYUV420NativeTextures( 486 frame = VideoFrame::WrapYUV420NativeTextures(
412 mailbox_holders[VideoFrame::kYPlane], 487 mailbox_holders[VideoFrame::kYPlane],
413 mailbox_holders[VideoFrame::kUPlane], 488 mailbox_holders[VideoFrame::kUPlane],
414 mailbox_holders[VideoFrame::kVPlane], 489 mailbox_holders[VideoFrame::kVPlane],
415 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources), 490 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources),
416 size, video_frame->visible_rect(), video_frame->natural_size(), 491 size, video_frame->visible_rect(), video_frame->natural_size(),
417 video_frame->timestamp()); 492 video_frame->timestamp());
418 if (video_frame->metadata()->IsTrue(VideoFrameMetadata::ALLOW_OVERLAY)) 493 if (video_frame->metadata()->IsTrue(VideoFrameMetadata::ALLOW_OVERLAY))
419 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); 494 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true);
420 break; 495 break;
496 case PIXEL_FORMAT_NV12:
421 case PIXEL_FORMAT_UYVY: 497 case PIXEL_FORMAT_UYVY:
422 frame = VideoFrame::WrapNativeTexture( 498 frame = VideoFrame::WrapNativeTexture(
423 PIXEL_FORMAT_UYVY, mailbox_holders[VideoFrame::kYPlane], 499 output_format_, mailbox_holders[VideoFrame::kYPlane],
424 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources), 500 base::Bind(&PoolImpl::MailboxHoldersReleased, this, frame_resources),
425 size, video_frame->visible_rect(), video_frame->natural_size(), 501 size, video_frame->visible_rect(), video_frame->natural_size(),
426 video_frame->timestamp()); 502 video_frame->timestamp());
427 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); 503 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true);
428 break; 504 break;
429 default: 505 default:
430 NOTREACHED(); 506 NOTREACHED();
431 } 507 }
432 frame_ready_cb.Run(frame); 508 frame_ready_cb.Run(frame);
433 } 509 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 gles2->ActiveTexture(GL_TEXTURE0); 551 gles2->ActiveTexture(GL_TEXTURE0);
476 size_t planes = VideoFrame::NumPlanes(format); 552 size_t planes = VideoFrame::NumPlanes(format);
477 FrameResources* frame_resources = new FrameResources(size); 553 FrameResources* frame_resources = new FrameResources(size);
478 resources_pool_.push_back(frame_resources); 554 resources_pool_.push_back(frame_resources);
479 for (size_t i = 0; i < planes; ++i) { 555 for (size_t i = 0; i < planes; ++i) {
480 PlaneResource& plane_resource = frame_resources->plane_resources[i]; 556 PlaneResource& plane_resource = frame_resources->plane_resources[i];
481 const size_t width = VideoFrame::Columns(i, format, size.width()); 557 const size_t width = VideoFrame::Columns(i, format, size.width());
482 const size_t height = VideoFrame::Rows(i, format, size.height()); 558 const size_t height = VideoFrame::Rows(i, format, size.height());
483 const gfx::Size plane_size(width, height); 559 const gfx::Size plane_size(width, height);
484 560
561 const gfx::BufferFormat buffer_format = GpuMemoryBufferFormat(format, i);
485 plane_resource.gpu_memory_buffer = gpu_factories_->AllocateGpuMemoryBuffer( 562 plane_resource.gpu_memory_buffer = gpu_factories_->AllocateGpuMemoryBuffer(
486 plane_size, GpuMemoryBufferFormat(format, i), gfx::BufferUsage::MAP); 563 plane_size, buffer_format, gfx::BufferUsage::MAP);
487 564
488 gles2->GenTextures(1, &plane_resource.texture_id); 565 gles2->GenTextures(1, &plane_resource.texture_id);
489 gles2->BindTexture(texture_target_, plane_resource.texture_id); 566 gles2->BindTexture(texture_target_, plane_resource.texture_id);
490 gles2->TexParameteri(texture_target_, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 567 gles2->TexParameteri(texture_target_, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
491 gles2->TexParameteri(texture_target_, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 568 gles2->TexParameteri(texture_target_, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
492 gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 569 gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
493 gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 570 gles2->TexParameteri(texture_target_, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
494 gles2->GenMailboxCHROMIUM(plane_resource.mailbox.name); 571 gles2->GenMailboxCHROMIUM(plane_resource.mailbox.name);
495 gles2->ProduceTextureCHROMIUM(texture_target_, plane_resource.mailbox.name); 572 gles2->ProduceTextureCHROMIUM(texture_target_, plane_resource.mailbox.name);
573
574 size_t buffer_planes = gfx::NumberOfPlanesForBufferFormat(buffer_format);
575 if (buffer_planes > 1) {
576 // Got a multi-planar buffer, assume all the planes fit in it.
577 DCHECK_EQ(planes, buffer_planes);
578 break;
579 }
496 } 580 }
497 return frame_resources; 581 return frame_resources;
498 } 582 }
499 583
500 // static 584 // static
501 void GpuMemoryBufferVideoFramePool::PoolImpl::DeleteFrameResources( 585 void GpuMemoryBufferVideoFramePool::PoolImpl::DeleteFrameResources(
502 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, 586 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories,
503 FrameResources* frame_resources) { 587 FrameResources* frame_resources) {
504 // TODO(dcastagna): As soon as the context lost is dealt with in media, 588 // TODO(dcastagna): As soon as the context lost is dealt with in media,
505 // make sure that we won't execute this callback (use a weak pointer to 589 // make sure that we won't execute this callback (use a weak pointer to
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 } 635 }
552 636
553 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame( 637 void GpuMemoryBufferVideoFramePool::MaybeCreateHardwareFrame(
554 const scoped_refptr<VideoFrame>& video_frame, 638 const scoped_refptr<VideoFrame>& video_frame,
555 const FrameReadyCB& frame_ready_cb) { 639 const FrameReadyCB& frame_ready_cb) {
556 DCHECK(video_frame); 640 DCHECK(video_frame);
557 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb); 641 pool_impl_->CreateHardwareFrame(video_frame, frame_ready_cb);
558 } 642 }
559 643
560 } // namespace media 644 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698