OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layers/video_layer_impl.h" | 5 #include "cc/layers/video_layer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "cc/layers/quad_sink.h" | 9 #include "cc/layers/quad_sink.h" |
10 #include "cc/layers/video_frame_provider_client_impl.h" | 10 #include "cc/layers/video_frame_provider_client_impl.h" |
11 #include "cc/quads/io_surface_draw_quad.h" | 11 #include "cc/quads/io_surface_draw_quad.h" |
12 #include "cc/quads/stream_video_draw_quad.h" | 12 #include "cc/quads/stream_video_draw_quad.h" |
13 #include "cc/quads/texture_draw_quad.h" | 13 #include "cc/quads/texture_draw_quad.h" |
14 #include "cc/quads/yuv_video_draw_quad.h" | 14 #include "cc/quads/yuv_video_draw_quad.h" |
15 #include "cc/resources/resource_provider.h" | 15 #include "cc/resources/resource_provider.h" |
| 16 #include "cc/resources/scoped_release_callback.h" |
16 #include "cc/trees/layer_tree_impl.h" | 17 #include "cc/trees/layer_tree_impl.h" |
17 #include "cc/trees/proxy.h" | 18 #include "cc/trees/proxy.h" |
18 #include "media/base/video_frame.h" | 19 #include "media/base/video_frame.h" |
19 | 20 |
20 #if defined(GOOGLE_TV) | 21 #if defined(GOOGLE_TV) |
21 #include "cc/quads/solid_color_draw_quad.h" | 22 #include "cc/quads/solid_color_draw_quad.h" |
22 #endif | 23 #endif |
23 | 24 |
24 namespace cc { | 25 namespace cc { |
25 | 26 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 frame_resource_type_ = external_resources.type; | 105 frame_resource_type_ = external_resources.type; |
105 | 106 |
106 if (external_resources.type == | 107 if (external_resources.type == |
107 VideoFrameExternalResources::SOFTWARE_RESOURCE) { | 108 VideoFrameExternalResources::SOFTWARE_RESOURCE) { |
108 software_resources_ = external_resources.software_resources; | 109 software_resources_ = external_resources.software_resources; |
109 software_release_callback_ = | 110 software_release_callback_ = |
110 external_resources.software_release_callback; | 111 external_resources.software_release_callback; |
111 return true; | 112 return true; |
112 } | 113 } |
113 | 114 |
| 115 DCHECK_EQ(external_resources.mailboxes.size(), |
| 116 external_resources.release_callbacks.size()); |
114 for (size_t i = 0; i < external_resources.mailboxes.size(); ++i) { | 117 for (size_t i = 0; i < external_resources.mailboxes.size(); ++i) { |
115 frame_resources_.push_back( | 118 unsigned resource_id = resource_provider->CreateResourceFromTextureMailbox( |
116 resource_provider->CreateResourceFromTextureMailbox( | 119 external_resources.mailboxes[i], |
117 external_resources.mailboxes[i])); | 120 ScopedReleaseCallback::Create(external_resources.release_callbacks[i])); |
| 121 frame_resources_.push_back(resource_id); |
118 } | 122 } |
119 | 123 |
120 return true; | 124 return true; |
121 } | 125 } |
122 | 126 |
123 void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, | 127 void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, |
124 AppendQuadsData* append_quads_data) { | 128 AppendQuadsData* append_quads_data) { |
125 DCHECK(frame_.get()); | 129 DCHECK(frame_.get()); |
126 | 130 |
127 SharedQuadState* shared_quad_state = | 131 SharedQuadState* shared_quad_state = |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 void VideoLayerImpl::SetProviderClientImpl( | 309 void VideoLayerImpl::SetProviderClientImpl( |
306 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { | 310 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
307 provider_client_impl_ = provider_client_impl; | 311 provider_client_impl_ = provider_client_impl; |
308 } | 312 } |
309 | 313 |
310 const char* VideoLayerImpl::LayerTypeAsString() const { | 314 const char* VideoLayerImpl::LayerTypeAsString() const { |
311 return "cc::VideoLayerImpl"; | 315 return "cc::VideoLayerImpl"; |
312 } | 316 } |
313 | 317 |
314 } // namespace cc | 318 } // namespace cc |
OLD | NEW |