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

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

Issue 14199002: Send hardware video frames with mailboxes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: video-mailbox: virtualandroid Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/resources/video_resource_updater.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 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ 5 #ifndef CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_
6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ 6 #define CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 29 matching lines...) Expand all
40 #endif 40 #endif
41 41
42 // TODO(danakj): Remove this and abstract TextureMailbox into 42 // TODO(danakj): Remove this and abstract TextureMailbox into
43 // "ExternalResource" that can hold a hardware or software backing. 43 // "ExternalResource" that can hold a hardware or software backing.
44 SOFTWARE_RESOURCE 44 SOFTWARE_RESOURCE
45 }; 45 };
46 46
47 ResourceType type; 47 ResourceType type;
48 std::vector<TextureMailbox> mailboxes; 48 std::vector<TextureMailbox> mailboxes;
49 49
50 // TODO(danakj): Remove these when we get a Mailbox from VideoFrame.
51 unsigned hardware_resource;
52 TextureMailbox::ReleaseCallback hardware_release_callback;
53
54 // TODO(danakj): Remove these too. 50 // TODO(danakj): Remove these too.
55 std::vector<unsigned> software_resources; 51 std::vector<unsigned> software_resources;
56 TextureMailbox::ReleaseCallback software_release_callback; 52 TextureMailbox::ReleaseCallback software_release_callback;
57 53
58 VideoFrameExternalResources(); 54 VideoFrameExternalResources();
59 ~VideoFrameExternalResources(); 55 ~VideoFrameExternalResources();
60 }; 56 };
61 57
62 // VideoResourceUpdater is by the video system to produce frame content as 58 // VideoResourceUpdater is by the video system to produce frame content as
63 // resources consumable by the compositor. 59 // resources consumable by the compositor.
64 class VideoResourceUpdater 60 class VideoResourceUpdater
65 : public base::SupportsWeakPtr<VideoResourceUpdater> { 61 : public base::SupportsWeakPtr<VideoResourceUpdater> {
66 public: 62 public:
67 explicit VideoResourceUpdater(ResourceProvider* resource_provider); 63 explicit VideoResourceUpdater(ResourceProvider* resource_provider);
68 ~VideoResourceUpdater(); 64 ~VideoResourceUpdater();
69 65
70 VideoFrameExternalResources CreateForHardwarePlanes( 66 VideoFrameExternalResources CreateExternalResourcesFromVideoFrame(
71 const scoped_refptr<media::VideoFrame>& video_frame);
72
73 VideoFrameExternalResources CreateForSoftwarePlanes(
74 const scoped_refptr<media::VideoFrame>& video_frame); 67 const scoped_refptr<media::VideoFrame>& video_frame);
75 68
76 private: 69 private:
77 struct PlaneResource { 70 struct PlaneResource {
78 unsigned resource_id; 71 unsigned resource_id;
79 gfx::Size resource_size; 72 gfx::Size resource_size;
80 unsigned resource_format; 73 unsigned resource_format;
81 gpu::Mailbox mailbox; 74 gpu::Mailbox mailbox;
82 75
83 PlaneResource(unsigned resource_id, 76 PlaneResource(unsigned resource_id,
84 gfx::Size resource_size, 77 gfx::Size resource_size,
85 unsigned resource_format, 78 unsigned resource_format,
86 gpu::Mailbox mailbox) 79 gpu::Mailbox mailbox)
87 : resource_id(resource_id), 80 : resource_id(resource_id),
88 resource_size(resource_size), 81 resource_size(resource_size),
89 resource_format(resource_format), 82 resource_format(resource_format),
90 mailbox(mailbox) {} 83 mailbox(mailbox) {}
91 }; 84 };
92 85
93 void DeleteResource(unsigned resource_id); 86 void DeleteResource(unsigned resource_id);
94 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame); 87 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame);
88 VideoFrameExternalResources CreateForHardwarePlanes(
89 const scoped_refptr<media::VideoFrame>& video_frame);
90 VideoFrameExternalResources CreateForSoftwarePlanes(
91 const scoped_refptr<media::VideoFrame>& video_frame);
95 92
96 struct RecycleResourceData { 93 struct RecycleResourceData {
97 unsigned resource_id; 94 unsigned resource_id;
98 gfx::Size resource_size; 95 gfx::Size resource_size;
99 unsigned resource_format; 96 unsigned resource_format;
100 gpu::Mailbox mailbox; 97 gpu::Mailbox mailbox;
101 }; 98 };
102 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, 99 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater,
103 RecycleResourceData data, 100 RecycleResourceData data,
104 unsigned sync_point, 101 unsigned sync_point,
105 bool lost_resource); 102 bool lost_resource);
106 static void ReturnTexture(base::WeakPtr<VideoResourceUpdater> updater,
107 unsigned resource_id,
108 unsigned sync_point,
109 bool lost_resource);
110 103
111 ResourceProvider* resource_provider_; 104 ResourceProvider* resource_provider_;
112 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; 105 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_;
113 106
114 std::vector<unsigned> all_resources_; 107 std::vector<unsigned> all_resources_;
115 std::vector<PlaneResource> recycled_resources_; 108 std::vector<PlaneResource> recycled_resources_;
116 109
117 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); 110 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater);
118 }; 111 };
119 112
120 } // namespace cc 113 } // namespace cc
121 114
122 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ 115 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_
OLDNEW
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698