| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 | 646 |
| 647 // Sync point for use of frame copy. | 647 // Sync point for use of frame copy. |
| 648 gpu::SyncToken sync_token; | 648 gpu::SyncToken sync_token; |
| 649 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); | 649 const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM(); |
| 650 gl->ShallowFlushCHROMIUM(); | 650 gl->ShallowFlushCHROMIUM(); |
| 651 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); | 651 gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); |
| 652 | 652 |
| 653 // Done with the source video frame texture at this point. | 653 // Done with the source video frame texture at this point. |
| 654 video_frame->UpdateReleaseSyncToken(&client); | 654 video_frame->UpdateReleaseSyncToken(&client); |
| 655 | 655 |
| 656 external_resources->mailboxes.push_back( | 656 external_resources->mailboxes.push_back(TextureMailbox( |
| 657 TextureMailbox(resource->mailbox, sync_token, GL_TEXTURE_2D, | 657 resource->mailbox, sync_token, GL_TEXTURE_2D, video_frame->coded_size(), |
| 658 video_frame->coded_size(), false, false)); | 658 gfx::GpuMemoryBufferHandle(), false, false)); |
| 659 | 659 |
| 660 external_resources->release_callbacks.push_back( | 660 external_resources->release_callbacks.push_back( |
| 661 base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id)); | 661 base::Bind(&RecycleResource, AsWeakPtr(), resource->resource_id)); |
| 662 } | 662 } |
| 663 | 663 |
| 664 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( | 664 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( |
| 665 scoped_refptr<media::VideoFrame> video_frame) { | 665 scoped_refptr<media::VideoFrame> video_frame) { |
| 666 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes"); | 666 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForHardwarePlanes"); |
| 667 DCHECK(video_frame->HasTextures()); | 667 DCHECK(video_frame->HasTextures()); |
| 668 if (!context_provider_) | 668 if (!context_provider_) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 687 if (mailbox_holder.mailbox.IsZero()) | 687 if (mailbox_holder.mailbox.IsZero()) |
| 688 break; | 688 break; |
| 689 | 689 |
| 690 if (video_frame->metadata()->IsTrue( | 690 if (video_frame->metadata()->IsTrue( |
| 691 media::VideoFrameMetadata::COPY_REQUIRED)) { | 691 media::VideoFrameMetadata::COPY_REQUIRED)) { |
| 692 CopyPlaneTexture(video_frame.get(), mailbox_holder, &external_resources); | 692 CopyPlaneTexture(video_frame.get(), mailbox_holder, &external_resources); |
| 693 } else { | 693 } else { |
| 694 external_resources.mailboxes.push_back(TextureMailbox( | 694 external_resources.mailboxes.push_back(TextureMailbox( |
| 695 mailbox_holder.mailbox, mailbox_holder.sync_token, | 695 mailbox_holder.mailbox, mailbox_holder.sync_token, |
| 696 mailbox_holder.texture_target, video_frame->coded_size(), | 696 mailbox_holder.texture_target, video_frame->coded_size(), |
| 697 gfx::GpuMemoryBufferHandle(), |
| 697 video_frame->metadata()->IsTrue( | 698 video_frame->metadata()->IsTrue( |
| 698 media::VideoFrameMetadata::ALLOW_OVERLAY), | 699 media::VideoFrameMetadata::ALLOW_OVERLAY), |
| 699 false)); | 700 false)); |
| 700 | 701 |
| 701 external_resources.release_callbacks.push_back( | 702 external_resources.release_callbacks.push_back( |
| 702 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); | 703 base::Bind(&ReturnTexture, AsWeakPtr(), video_frame)); |
| 703 } | 704 } |
| 704 } | 705 } |
| 705 return external_resources; | 706 return external_resources; |
| 706 } | 707 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 plane_resource.plane_index == 0; | 758 plane_resource.plane_index == 0; |
| 758 }); | 759 }); |
| 759 if (resource_it == updater->all_resources_.end()) | 760 if (resource_it == updater->all_resources_.end()) |
| 760 return; | 761 return; |
| 761 | 762 |
| 762 resource_it->destructed = true; | 763 resource_it->destructed = true; |
| 763 } | 764 } |
| 764 #endif | 765 #endif |
| 765 | 766 |
| 766 } // namespace cc | 767 } // namespace cc |
| OLD | NEW |