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> |
| 9 |
8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
11 #include "cc/layers/video_frame_provider.h" | 13 #include "cc/layers/video_frame_provider.h" |
12 #include "gpu/command_buffer/common/mailbox.h" | 14 #include "gpu/command_buffer/common/mailbox.h" |
13 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
14 | 16 |
15 namespace gpu { | 17 namespace gpu { |
16 namespace gles2 { | 18 namespace gles2 { |
17 class GLES2Interface; | 19 class GLES2Interface; |
18 } // namespace gles2 | 20 } // namespace gles2 |
19 } // namespace gpu | 21 } // namespace gpu |
20 | 22 |
21 namespace content { | 23 namespace content { |
22 | 24 |
23 // The proxy class for the gpu thread to notify the compositor thread | 25 // The proxy class for the gpu thread to notify the compositor thread |
24 // when a new video frame is available. | 26 // when a new video frame is available. |
25 class StreamTextureProxy { | 27 class StreamTextureProxy { |
26 public: | 28 public: |
27 virtual ~StreamTextureProxy() {} | 29 virtual ~StreamTextureProxy() {} |
28 | 30 |
29 // Initialize and bind to the loop, which becomes the thread that | 31 // Initialize and bind to the loop, which becomes the thread that |
30 // a connected client will receive callbacks on. This can be called | 32 // a connected client will receive callbacks on. This can be called |
31 // on any thread, but must be called with the same loop every time. | 33 // on any thread, but must be called with the same loop every time. |
32 virtual void BindToLoop(int32 stream_id, | 34 virtual void BindToLoop(int32_t stream_id, |
33 cc::VideoFrameProvider::Client* client, | 35 cc::VideoFrameProvider::Client* client, |
34 scoped_refptr<base::SingleThreadTaskRunner> loop) = 0; | 36 scoped_refptr<base::SingleThreadTaskRunner> loop) = 0; |
35 | 37 |
36 // Causes this instance to be deleted on the thread it is bound to. | 38 // Causes this instance to be deleted on the thread it is bound to. |
37 virtual void Release() = 0; | 39 virtual void Release() = 0; |
38 | 40 |
39 struct Deleter { | 41 struct Deleter { |
40 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } | 42 inline void operator()(StreamTextureProxy* ptr) const { ptr->Release(); } |
41 }; | 43 }; |
42 }; | 44 }; |
(...skipping 10 matching lines...) Expand all Loading... |
53 // Factory class for managing stream textures. | 55 // Factory class for managing stream textures. |
54 class StreamTextureFactory : public base::RefCounted<StreamTextureFactory> { | 56 class StreamTextureFactory : public base::RefCounted<StreamTextureFactory> { |
55 public: | 57 public: |
56 // Create the StreamTextureProxy object. | 58 // Create the StreamTextureProxy object. |
57 virtual StreamTextureProxy* CreateProxy() = 0; | 59 virtual StreamTextureProxy* CreateProxy() = 0; |
58 | 60 |
59 // Send an IPC message to the browser process to request a java surface | 61 // Send an IPC message to the browser process to request a java surface |
60 // object for the given stream_id. After the the surface is created, | 62 // object for the given stream_id. After the the surface is created, |
61 // it will be passed back to the WebMediaPlayerAndroid object identified by | 63 // it will be passed back to the WebMediaPlayerAndroid object identified by |
62 // the player_id. | 64 // the player_id. |
63 virtual void EstablishPeer(int32 stream_id, int player_id, int frame_id) = 0; | 65 virtual void EstablishPeer(int32_t stream_id, |
| 66 int player_id, |
| 67 int frame_id) = 0; |
64 | 68 |
65 // Creates a StreamTexture and returns its id. Sets |*texture_id| to the | 69 // Creates a StreamTexture and returns its id. Sets |*texture_id| to the |
66 // client-side id of the StreamTexture. The texture is produced into | 70 // client-side id of the StreamTexture. The texture is produced into |
67 // a mailbox so it can be shipped in a VideoFrame. | 71 // a mailbox so it can be shipped in a VideoFrame. |
68 virtual unsigned CreateStreamTexture(unsigned texture_target, | 72 virtual unsigned CreateStreamTexture(unsigned texture_target, |
69 unsigned* texture_id, | 73 unsigned* texture_id, |
70 gpu::Mailbox* texture_mailbox) = 0; | 74 gpu::Mailbox* texture_mailbox) = 0; |
71 | 75 |
72 // Set the streamTexture size for the given stream Id. | 76 // Set the streamTexture size for the given stream Id. |
73 virtual void SetStreamTextureSize(int32 texture_id, | 77 virtual void SetStreamTextureSize(int32_t texture_id, |
74 const gfx::Size& size) = 0; | 78 const gfx::Size& size) = 0; |
75 | 79 |
76 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; | 80 virtual gpu::gles2::GLES2Interface* ContextGL() = 0; |
77 | 81 |
78 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) = 0; | 82 virtual void AddObserver(StreamTextureFactoryContextObserver* obs) = 0; |
79 virtual void RemoveObserver(StreamTextureFactoryContextObserver* obs) = 0; | 83 virtual void RemoveObserver(StreamTextureFactoryContextObserver* obs) = 0; |
80 | 84 |
81 protected: | 85 protected: |
82 friend class base::RefCounted<StreamTextureFactory>; | 86 friend class base::RefCounted<StreamTextureFactory>; |
83 virtual ~StreamTextureFactory() {} | 87 virtual ~StreamTextureFactory() {} |
84 }; | 88 }; |
85 | 89 |
86 } // namespace content | 90 } // namespace content |
87 | 91 |
88 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ | 92 #endif // CONTENT_RENDERER_MEDIA_ANDROID_STREAM_TEXTURE_FACTORY_H_ |
OLD | NEW |