| OLD | NEW |
| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 case media::VideoFrame::TEXTURE_YUV_420: | 431 case media::VideoFrame::TEXTURE_YUV_420: |
| 432 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; | 432 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; |
| 433 break; | 433 break; |
| 434 } | 434 } |
| 435 DCHECK_NE(VideoFrameExternalResources::NONE, external_resources.type); | 435 DCHECK_NE(VideoFrameExternalResources::NONE, external_resources.type); |
| 436 | 436 |
| 437 for (size_t i = 0; i < textures; ++i) { | 437 for (size_t i = 0; i < textures; ++i) { |
| 438 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(i); | 438 const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(i); |
| 439 external_resources.mailboxes.push_back( | 439 external_resources.mailboxes.push_back( |
| 440 TextureMailbox(mailbox_holder.mailbox, mailbox_holder.texture_target, | 440 TextureMailbox(mailbox_holder.mailbox, mailbox_holder.texture_target, |
| 441 mailbox_holder.sync_point)); | 441 mailbox_holder.sync_point, video_frame->coded_size(), |
| 442 external_resources.mailboxes.back().set_allow_overlay( | 442 video_frame->allow_overlay())); |
| 443 video_frame->allow_overlay()); | |
| 444 external_resources.release_callbacks.push_back( | 443 external_resources.release_callbacks.push_back( |
| 445 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); | 444 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); |
| 446 } | 445 } |
| 447 return external_resources; | 446 return external_resources; |
| 448 } | 447 } |
| 449 | 448 |
| 450 // static | 449 // static |
| 451 void VideoResourceUpdater::RecycleResource( | 450 void VideoResourceUpdater::RecycleResource( |
| 452 base::WeakPtr<VideoResourceUpdater> updater, | 451 base::WeakPtr<VideoResourceUpdater> updater, |
| 453 ResourceId resource_id, | 452 ResourceId resource_id, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 476 resource_it->ref_count = 0; | 475 resource_it->ref_count = 0; |
| 477 updater->DeleteResource(resource_it); | 476 updater->DeleteResource(resource_it); |
| 478 return; | 477 return; |
| 479 } | 478 } |
| 480 | 479 |
| 481 --resource_it->ref_count; | 480 --resource_it->ref_count; |
| 482 DCHECK_GE(resource_it->ref_count, 0); | 481 DCHECK_GE(resource_it->ref_count, 0); |
| 483 } | 482 } |
| 484 | 483 |
| 485 } // namespace cc | 484 } // namespace cc |
| OLD | NEW |