Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_RENDERER_GPU_VIDEO_SERVICE_HOST_H_ | 5 #ifndef CHROME_RENDERER_GPU_VIDEO_SERVICE_HOST_H_ |
| 6 #define CHROME_RENDERER_GPU_VIDEO_SERVICE_HOST_H_ | 6 #define CHROME_RENDERER_GPU_VIDEO_SERVICE_HOST_H_ |
| 7 | 7 |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "chrome/common/gpu_video_common.h" | 9 #include "chrome/common/gpu_video_common.h" |
| 10 #include "chrome/renderer/gpu_channel_host.h" | 10 #include "chrome/renderer/gpu_channel_host.h" |
| 11 #include "chrome/renderer/gpu_video_decoder_host.h" | 11 #include "chrome/renderer/gpu_video_decoder_host.h" |
| 12 #include "ipc/ipc_channel.h" | 12 #include "ipc/ipc_channel.h" |
| 13 #include "media/base/buffers.h" | 13 #include "media/base/buffers.h" |
| 14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
| 15 | 15 |
| 16 // A GpuVideoServiceHost is a singleton in the renderer process that provides | |
| 17 // access to hardware accelerated video decoding device in the GPU process | |
| 18 // though a GpuVideoDecoderHost. | |
| 16 class GpuVideoServiceHost : public IPC::Channel::Listener, | 19 class GpuVideoServiceHost : public IPC::Channel::Listener, |
| 17 public Singleton<GpuVideoServiceHost> { | 20 public Singleton<GpuVideoServiceHost> { |
| 18 public: | 21 public: |
| 19 // IPC::Channel::Listener. | 22 // IPC::Channel::Listener. |
| 20 virtual void OnChannelConnected(int32 peer_pid) {} | 23 virtual void OnChannelConnected(int32 peer_pid) {} |
| 21 virtual void OnChannelError(); | 24 virtual void OnChannelError(); |
| 22 virtual void OnMessageReceived(const IPC::Message& message); | 25 virtual void OnMessageReceived(const IPC::Message& message); |
| 23 | 26 |
| 24 void OnRendererThreadInit(MessageLoop* message_loop); | 27 void OnRendererThreadInit(MessageLoop* message_loop); |
| 25 void OnGpuChannelConnected(GpuChannelHost* channel_host, | 28 void OnGpuChannelConnected(GpuChannelHost* channel_host, |
| 26 MessageRouter* router, | 29 MessageRouter* router, |
| 27 IPC::SyncChannel* channel); | 30 IPC::SyncChannel* channel); |
| 28 | 31 |
| 29 // call at RenderThread. one per renderer process. | 32 // Called by GpuChannelHost when a GPU channel is established. |
| 30 scoped_refptr<GpuVideoDecoderHost> CreateVideoDecoder( | 33 void OnGpuChannelConnected(GpuChannelHost* channel_host, |
|
scherkus (not reviewing)
2010/09/01 03:29:40
wait.. this method is not declared twice
what's g
| |
| 31 GpuVideoDecoderHost::EventHandler* event_handler); | 34 MessageRouter* router, |
| 32 void DestroyVideoDecoder(scoped_refptr<GpuVideoDecoderHost>); | 35 IPC::SyncChannel* channel); |
| 36 | |
| 37 // Called on RenderThread to create a hardware accelerated video decoder | |
| 38 // in the GPU process. | |
| 39 // | |
| 40 // A routing ID for the GLES2 context needs to be provided when creating a | |
| 41 // hardware video decoder. This is important because the resources used by | |
| 42 // the video decoder needs to be shared with the GLES2 context corresponding | |
| 43 // to the RenderView. | |
| 44 // | |
| 45 // This means that a GPU video decoder is tied to a specific RenderView and | |
| 46 // its GLES2 context in the GPU process. | |
| 47 // | |
| 48 // Returns a GpuVideoDecoderHost as a handle to control the video decoder. | |
| 49 GpuVideoDecoderHost* CreateVideoDecoder(int context_route_id); | |
| 50 | |
| 51 // TODO(hclam): Provide a method to destroy the decoder. We also need to | |
| 52 // listen to context lost event. | |
| 53 | |
| 54 // Methods called by GpuVideoDecoderHost. | |
| 55 void AddRoute(int route_id, GpuVideoDecoderHost* decoder_host); | |
| 56 void RemoveRoute(int route_id); | |
| 33 | 57 |
| 34 private: | 58 private: |
| 35 GpuVideoServiceHost(); | 59 GpuVideoServiceHost(); |
| 36 | 60 |
| 37 scoped_refptr<GpuChannelHost> channel_host_; | 61 scoped_refptr<GpuChannelHost> channel_host_; |
| 38 MessageRouter* router_; | 62 MessageRouter* router_; |
| 39 GpuVideoServiceInfoParam service_info_; | 63 GpuVideoServiceInfoParam service_info_; |
| 40 MessageLoop* message_loop_; // Message loop of render thread. | 64 MessageLoop* message_loop_; // Message loop of render thread. |
| 41 | 65 |
| 42 friend struct DefaultSingletonTraits<GpuVideoServiceHost>; | 66 friend struct DefaultSingletonTraits<GpuVideoServiceHost>; |
| 43 DISALLOW_COPY_AND_ASSIGN(GpuVideoServiceHost); | 67 DISALLOW_COPY_AND_ASSIGN(GpuVideoServiceHost); |
| 44 }; | 68 }; |
| 45 | 69 |
| 46 #endif // CHROME_RENDERER_GPU_VIDEO_SERVICE_HOST_H_ | 70 #endif // CHROME_RENDERER_GPU_VIDEO_SERVICE_HOST_H_ |
| 47 | |
| OLD | NEW |