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

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 1117423002: media: Let VideoFrame carry more than one native texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reveman's comments. Created 5 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
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_unittest_context.cc » ('j') | media/base/video_frame.h » ('J')
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes"); 401 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes");
402 media::VideoFrame::Format frame_format = video_frame->format(); 402 media::VideoFrame::Format frame_format = video_frame->format();
403 403
404 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); 404 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE);
405 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) 405 if (frame_format != media::VideoFrame::NATIVE_TEXTURE)
406 return VideoFrameExternalResources(); 406 return VideoFrameExternalResources();
407 407
408 if (!context_provider_) 408 if (!context_provider_)
409 return VideoFrameExternalResources(); 409 return VideoFrameExternalResources();
410 410
411 const gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); 411 DCHECK_EQ(1u, media::VideoFrame::NumTextures(video_frame->texture_format()));
412 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0);
412 VideoFrameExternalResources external_resources; 413 VideoFrameExternalResources external_resources;
413 switch (mailbox_holder->texture_target) { 414 switch (mailbox_holder.texture_target) {
414 case GL_TEXTURE_2D: 415 case GL_TEXTURE_2D:
415 external_resources.type = VideoFrameExternalResources::RGB_RESOURCE; 416 external_resources.type = VideoFrameExternalResources::RGB_RESOURCE;
416 break; 417 break;
417 case GL_TEXTURE_EXTERNAL_OES: 418 case GL_TEXTURE_EXTERNAL_OES:
418 external_resources.type = 419 external_resources.type =
419 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE; 420 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE;
420 break; 421 break;
421 case GL_TEXTURE_RECTANGLE_ARB: 422 case GL_TEXTURE_RECTANGLE_ARB:
422 external_resources.type = VideoFrameExternalResources::IO_SURFACE; 423 external_resources.type = VideoFrameExternalResources::IO_SURFACE;
423 break; 424 break;
424 default: 425 default:
425 NOTREACHED(); 426 NOTREACHED();
426 return VideoFrameExternalResources(); 427 return VideoFrameExternalResources();
427 } 428 }
428 429
429 external_resources.mailboxes.push_back( 430 external_resources.mailboxes.push_back(
430 TextureMailbox(mailbox_holder->mailbox, 431 TextureMailbox(mailbox_holder.mailbox, mailbox_holder.texture_target,
431 mailbox_holder->texture_target, 432 mailbox_holder.sync_point));
432 mailbox_holder->sync_point));
433 external_resources.mailboxes.back().set_allow_overlay( 433 external_resources.mailboxes.back().set_allow_overlay(
434 video_frame->allow_overlay()); 434 video_frame->allow_overlay());
435 external_resources.release_callbacks.push_back( 435 external_resources.release_callbacks.push_back(
436 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); 436 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame));
437 return external_resources; 437 return external_resources;
438 } 438 }
439 439
440 // static 440 // static
441 void VideoResourceUpdater::RecycleResource( 441 void VideoResourceUpdater::RecycleResource(
442 base::WeakPtr<VideoResourceUpdater> updater, 442 base::WeakPtr<VideoResourceUpdater> updater,
(...skipping 23 matching lines...) Expand all
466 resource_it->ref_count = 0; 466 resource_it->ref_count = 0;
467 updater->DeleteResource(resource_it); 467 updater->DeleteResource(resource_it);
468 return; 468 return;
469 } 469 }
470 470
471 --resource_it->ref_count; 471 --resource_it->ref_count;
472 DCHECK_GE(resource_it->ref_count, 0); 472 DCHECK_GE(resource_it->ref_count, 0);
473 } 473 }
474 474
475 } // namespace cc 475 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_unittest_context.cc » ('j') | media/base/video_frame.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698