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

Side by Side Diff: cc/resources/video_resource_updater.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: 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
« no previous file with comments | « no previous file | cc/test/test_gpu_memory_buffer_manager.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 break; 400 break;
401 default: 401 default:
402 NOTREACHED(); 402 NOTREACHED();
403 return VideoFrameExternalResources(); 403 return VideoFrameExternalResources();
404 } 404 }
405 break; 405 break;
406 case media::PIXEL_FORMAT_I420: 406 case media::PIXEL_FORMAT_I420:
407 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; 407 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE;
408 break; 408 break;
409 case media::PIXEL_FORMAT_NV12: 409 case media::PIXEL_FORMAT_NV12:
410 DCHECK(video_frame->mailbox_holder(0).texture_target ==
411 GL_TEXTURE_RECTANGLE_ARB);
412 external_resources.type = VideoFrameExternalResources::IO_SURFACE;
413 break;
410 case media::PIXEL_FORMAT_YV12: 414 case media::PIXEL_FORMAT_YV12:
411 case media::PIXEL_FORMAT_YV16: 415 case media::PIXEL_FORMAT_YV16:
412 case media::PIXEL_FORMAT_YV24: 416 case media::PIXEL_FORMAT_YV24:
413 case media::PIXEL_FORMAT_YV12A: 417 case media::PIXEL_FORMAT_YV12A:
414 case media::PIXEL_FORMAT_UNKNOWN: 418 case media::PIXEL_FORMAT_UNKNOWN:
415 DLOG(ERROR) << "Unsupported Texture format" 419 DLOG(ERROR) << "Unsupported Texture format"
416 << media::VideoPixelFormatToString(video_frame->format()); 420 << media::VideoPixelFormatToString(video_frame->format());
417 return external_resources; 421 return external_resources;
418 } 422 }
419 DCHECK_NE(VideoFrameExternalResources::NONE, external_resources.type); 423 DCHECK_NE(VideoFrameExternalResources::NONE, external_resources.type);
420 424
421 for (size_t i = 0; i < textures; ++i) { 425 for (size_t i = 0; i < textures; ++i) {
422 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(i); 426 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(i);
427 if (mailbox_holder.mailbox.IsZero())
428 break;
423 external_resources.mailboxes.push_back( 429 external_resources.mailboxes.push_back(
424 TextureMailbox(mailbox_holder.mailbox, mailbox_holder.texture_target, 430 TextureMailbox(mailbox_holder.mailbox, mailbox_holder.texture_target,
425 mailbox_holder.sync_point, video_frame->coded_size(), 431 mailbox_holder.sync_point, video_frame->coded_size(),
426 video_frame->metadata()->IsTrue( 432 video_frame->metadata()->IsTrue(
427 media::VideoFrameMetadata::ALLOW_OVERLAY))); 433 media::VideoFrameMetadata::ALLOW_OVERLAY)));
428 external_resources.release_callbacks.push_back( 434 external_resources.release_callbacks.push_back(
429 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); 435 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame));
430 } 436 }
431 return external_resources; 437 return external_resources;
432 } 438 }
(...skipping 27 matching lines...) Expand all
460 resource_it->ref_count = 0; 466 resource_it->ref_count = 0;
461 updater->DeleteResource(resource_it); 467 updater->DeleteResource(resource_it);
462 return; 468 return;
463 } 469 }
464 470
465 --resource_it->ref_count; 471 --resource_it->ref_count;
466 DCHECK_GE(resource_it->ref_count, 0); 472 DCHECK_GE(resource_it->ref_count, 0);
467 } 473 }
468 474
469 } // namespace cc 475 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/test/test_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698