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

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: Use the texture target in the hardware video frame Created 7 years, 8 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
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 unsigned sync_point; 74 unsigned sync_point;
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 unsigned sync_point) 79 unsigned sync_point)
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 sync_point(sync_point) {} 83 sync_point(sync_point) {}
91 }; 84 };
92 85
93 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame); 86 bool VerifyFrame(const scoped_refptr<media::VideoFrame>& video_frame);
87 VideoFrameExternalResources CreateForHardwarePlanes(
88 const scoped_refptr<media::VideoFrame>& video_frame);
89 VideoFrameExternalResources CreateForSoftwarePlanes(
90 const scoped_refptr<media::VideoFrame>& video_frame);
94 91
95 struct RecycleResourceData { 92 struct RecycleResourceData {
96 unsigned resource_id; 93 unsigned resource_id;
97 gfx::Size resource_size; 94 gfx::Size resource_size;
98 unsigned resource_format; 95 unsigned resource_format;
99 gpu::Mailbox mailbox; 96 gpu::Mailbox mailbox;
100 }; 97 };
101 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, 98 static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater,
102 ResourceProvider* resource_provider, 99 ResourceProvider* resource_provider,
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(ResourceProvider* resource_provider, 103 static void ReturnTexture(scoped_refptr<media::VideoFrame> video_frame,
107 unsigned resource_id,
108 unsigned sync_point, 104 unsigned sync_point,
109 bool lost_resource); 105 bool lost_resource);
110 106
111 ResourceProvider* resource_provider_; 107 ResourceProvider* resource_provider_;
112 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_; 108 scoped_ptr<media::SkCanvasVideoRenderer> video_renderer_;
113 109
114 std::vector<PlaneResource> recycled_resources_; 110 std::vector<PlaneResource> recycled_resources_;
115 111
116 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater); 112 DISALLOW_COPY_AND_ASSIGN(VideoResourceUpdater);
117 }; 113 };
118 114
119 } // namespace cc 115 } // namespace cc
120 116
121 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_ 117 #endif // CC_RESOURCES_VIDEO_RESOURCE_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698