OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/unguessable_token.h" |
15 #include "cc/layers/video_frame_provider.h" | 16 #include "cc/layers/video_frame_provider.h" |
16 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
17 #include "content/renderer/gpu/stream_texture_host_android.h" | 18 #include "content/renderer/gpu/stream_texture_host_android.h" |
18 #include "gpu/command_buffer/common/mailbox.h" | 19 #include "gpu/command_buffer/common/mailbox.h" |
19 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
20 | 21 |
21 namespace gpu { | 22 namespace gpu { |
22 namespace gles2 { | 23 namespace gles2 { |
23 class GLES2Interface; | 24 class GLES2Interface; |
24 } // namespace gles2 | 25 } // namespace gles2 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 80 |
80 // Create the StreamTextureProxy object. | 81 // Create the StreamTextureProxy object. |
81 StreamTextureProxy* CreateProxy(); | 82 StreamTextureProxy* CreateProxy(); |
82 | 83 |
83 // Send an IPC message to the browser process to request a java surface | 84 // Send an IPC message to the browser process to request a java surface |
84 // object for the given stream_id. After the the surface is created, | 85 // object for the given stream_id. After the the surface is created, |
85 // it will be passed back to the WebMediaPlayerAndroid object identified by | 86 // it will be passed back to the WebMediaPlayerAndroid object identified by |
86 // the player_id. | 87 // the player_id. |
87 void EstablishPeer(int32_t stream_id, int player_id, int frame_id); | 88 void EstablishPeer(int32_t stream_id, int player_id, int frame_id); |
88 | 89 |
| 90 // Sends an IPC to the GPU process. |
| 91 // Asks the StreamTexture to forward its SurfaceTexture to the |
| 92 // ScopedSurfaceRequestManager, using the gpu::ScopedSurfaceRequestConduit. |
| 93 void ForwardStreamTextureForSurfaceRequest( |
| 94 int32_t stream_id, |
| 95 const base::UnguessableToken& request_token); |
| 96 |
89 // Creates a gpu::StreamTexture and returns its id. Sets |*texture_id| to the | 97 // Creates a gpu::StreamTexture and returns its id. Sets |*texture_id| to the |
90 // client-side id of the gpu::StreamTexture. The texture is produced into | 98 // client-side id of the gpu::StreamTexture. The texture is produced into |
91 // a mailbox so it can be shipped in a VideoFrame. | 99 // a mailbox so it can be shipped in a VideoFrame. |
92 unsigned CreateStreamTexture(unsigned texture_target, | 100 unsigned CreateStreamTexture(unsigned texture_target, |
93 unsigned* texture_id, | 101 unsigned* texture_id, |
94 gpu::Mailbox* texture_mailbox); | 102 gpu::Mailbox* texture_mailbox); |
95 | 103 |
96 // Set the streamTexture size for the given stream Id. | 104 // Set the streamTexture size for the given stream Id. |
97 void SetStreamTextureSize(int32_t texture_id, const gfx::Size& size); | 105 void SetStreamTextureSize(int32_t texture_id, const gfx::Size& size); |
98 | 106 |
99 gpu::gles2::GLES2Interface* ContextGL(); | 107 gpu::gles2::GLES2Interface* ContextGL(); |
100 | 108 |
101 private: | 109 private: |
102 friend class base::RefCounted<StreamTextureFactory>; | 110 friend class base::RefCounted<StreamTextureFactory>; |
103 StreamTextureFactory( | 111 StreamTextureFactory( |
104 scoped_refptr<ContextProviderCommandBuffer> context_provider); | 112 scoped_refptr<ContextProviderCommandBuffer> context_provider); |
105 ~StreamTextureFactory(); | 113 ~StreamTextureFactory(); |
106 | 114 |
107 scoped_refptr<ContextProviderCommandBuffer> context_provider_; | 115 scoped_refptr<ContextProviderCommandBuffer> context_provider_; |
108 scoped_refptr<gpu::GpuChannelHost> channel_; | 116 scoped_refptr<gpu::GpuChannelHost> channel_; |
109 | 117 |
110 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactory); | 118 DISALLOW_IMPLICIT_CONSTRUCTORS(StreamTextureFactory); |
111 }; | 119 }; |
112 | 120 |
113 } // namespace content | 121 } // namespace content |
114 | 122 |
115 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 123 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
OLD | NEW |