OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "gpu/command_buffer/client/gpu_control_client.h" |
16 #include "media/video/video_encode_accelerator.h" | 17 #include "media/video/video_encode_accelerator.h" |
17 #include "ppapi/c/pp_codecs.h" | 18 #include "ppapi/c/pp_codecs.h" |
18 #include "ppapi/c/ppb_video_frame.h" | 19 #include "ppapi/c/ppb_video_frame.h" |
19 #include "ppapi/host/host_message_context.h" | 20 #include "ppapi/host/host_message_context.h" |
20 #include "ppapi/host/resource_host.h" | 21 #include "ppapi/host/resource_host.h" |
21 #include "ppapi/proxy/resource_message_params.h" | 22 #include "ppapi/proxy/resource_message_params.h" |
22 #include "ppapi/shared_impl/media_stream_buffer_manager.h" | 23 #include "ppapi/shared_impl/media_stream_buffer_manager.h" |
23 | 24 |
24 namespace gpu { | 25 namespace gpu { |
25 class CommandBufferProxyImpl; | 26 class CommandBufferProxyImpl; |
26 class GpuChannelHost; | 27 class GpuChannelHost; |
27 } | 28 } |
28 | 29 |
29 namespace media { | 30 namespace media { |
30 class GpuVideoAcceleratorFactories; | 31 class GpuVideoAcceleratorFactories; |
31 } | 32 } |
32 | 33 |
33 namespace content { | 34 namespace content { |
34 | 35 |
35 class RendererPpapiHost; | 36 class RendererPpapiHost; |
36 class VideoEncoderShim; | 37 class VideoEncoderShim; |
37 | 38 |
38 class CONTENT_EXPORT PepperVideoEncoderHost | 39 class CONTENT_EXPORT PepperVideoEncoderHost |
39 : public ppapi::host::ResourceHost, | 40 : public ppapi::host::ResourceHost, |
40 public media::VideoEncodeAccelerator::Client, | 41 public media::VideoEncodeAccelerator::Client, |
41 public ppapi::MediaStreamBufferManager::Delegate { | 42 public ppapi::MediaStreamBufferManager::Delegate, |
| 43 public gpu::GpuControlClient { |
42 public: | 44 public: |
43 PepperVideoEncoderHost(RendererPpapiHost* host, | 45 PepperVideoEncoderHost(RendererPpapiHost* host, |
44 PP_Instance instance, | 46 PP_Instance instance, |
45 PP_Resource resource); | 47 PP_Resource resource); |
46 ~PepperVideoEncoderHost() override; | 48 ~PepperVideoEncoderHost() override; |
47 | 49 |
48 private: | 50 private: |
49 friend class VideoEncoderShim; | 51 friend class VideoEncoderShim; |
50 | 52 |
51 // Shared memory buffers. | 53 // Shared memory buffers. |
(...skipping 17 matching lines...) Expand all Loading... |
69 void BitstreamBufferReady(int32_t bitstream_buffer_id, | 71 void BitstreamBufferReady(int32_t bitstream_buffer_id, |
70 size_t payload_size, | 72 size_t payload_size, |
71 bool key_frame) override; | 73 bool key_frame) override; |
72 void NotifyError(media::VideoEncodeAccelerator::Error error) override; | 74 void NotifyError(media::VideoEncodeAccelerator::Error error) override; |
73 | 75 |
74 // ResourceHost implementation. | 76 // ResourceHost implementation. |
75 int32_t OnResourceMessageReceived( | 77 int32_t OnResourceMessageReceived( |
76 const IPC::Message& msg, | 78 const IPC::Message& msg, |
77 ppapi::host::HostMessageContext* context) override; | 79 ppapi::host::HostMessageContext* context) override; |
78 | 80 |
| 81 // GpuControlClient implementation. |
| 82 void OnGpuControlLostContext() override; |
| 83 void OnGpuControlErrorMessage(const char* msg, int id) override {} |
| 84 |
79 int32_t OnHostMsgGetSupportedProfiles( | 85 int32_t OnHostMsgGetSupportedProfiles( |
80 ppapi::host::HostMessageContext* context); | 86 ppapi::host::HostMessageContext* context); |
81 int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context, | 87 int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context, |
82 PP_VideoFrame_Format input_format, | 88 PP_VideoFrame_Format input_format, |
83 const PP_Size& input_visible_size, | 89 const PP_Size& input_visible_size, |
84 PP_VideoProfile output_profile, | 90 PP_VideoProfile output_profile, |
85 uint32_t initial_bitrate, | 91 uint32_t initial_bitrate, |
86 PP_HardwareAcceleration acceleration); | 92 PP_HardwareAcceleration acceleration); |
87 int32_t OnHostMsgGetVideoFrames(ppapi::host::HostMessageContext* context); | 93 int32_t OnHostMsgGetVideoFrames(ppapi::host::HostMessageContext* context); |
88 int32_t OnHostMsgEncode(ppapi::host::HostMessageContext* context, | 94 int32_t OnHostMsgEncode(ppapi::host::HostMessageContext* context, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 media::VideoPixelFormat media_input_format_; | 168 media::VideoPixelFormat media_input_format_; |
163 | 169 |
164 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; | 170 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; |
165 | 171 |
166 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); | 172 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); |
167 }; | 173 }; |
168 | 174 |
169 } // namespace content | 175 } // namespace content |
170 | 176 |
171 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ | 177 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ |
OLD | NEW |