| 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" | |
| 17 #include "media/video/video_encode_accelerator.h" | 16 #include "media/video/video_encode_accelerator.h" |
| 18 #include "ppapi/c/pp_codecs.h" | 17 #include "ppapi/c/pp_codecs.h" |
| 19 #include "ppapi/c/ppb_video_frame.h" | 18 #include "ppapi/c/ppb_video_frame.h" |
| 20 #include "ppapi/host/host_message_context.h" | 19 #include "ppapi/host/host_message_context.h" |
| 21 #include "ppapi/host/resource_host.h" | 20 #include "ppapi/host/resource_host.h" |
| 22 #include "ppapi/proxy/resource_message_params.h" | 21 #include "ppapi/proxy/resource_message_params.h" |
| 23 #include "ppapi/shared_impl/media_stream_buffer_manager.h" | 22 #include "ppapi/shared_impl/media_stream_buffer_manager.h" |
| 24 | 23 |
| 25 namespace gpu { | 24 namespace gpu { |
| 26 class CommandBufferProxyImpl; | 25 class CommandBufferProxyImpl; |
| 27 class GpuChannelHost; | 26 class GpuChannelHost; |
| 28 } | 27 } |
| 29 | 28 |
| 30 namespace media { | 29 namespace media { |
| 31 class GpuVideoAcceleratorFactories; | 30 class GpuVideoAcceleratorFactories; |
| 32 } | 31 } |
| 33 | 32 |
| 34 namespace content { | 33 namespace content { |
| 35 | 34 |
| 36 class RendererPpapiHost; | 35 class RendererPpapiHost; |
| 37 class VideoEncoderShim; | 36 class VideoEncoderShim; |
| 38 | 37 |
| 39 class CONTENT_EXPORT PepperVideoEncoderHost | 38 class CONTENT_EXPORT PepperVideoEncoderHost |
| 40 : public ppapi::host::ResourceHost, | 39 : public ppapi::host::ResourceHost, |
| 41 public media::VideoEncodeAccelerator::Client, | 40 public media::VideoEncodeAccelerator::Client, |
| 42 public ppapi::MediaStreamBufferManager::Delegate, | 41 public ppapi::MediaStreamBufferManager::Delegate { |
| 43 public gpu::GpuControlClient { | |
| 44 public: | 42 public: |
| 45 PepperVideoEncoderHost(RendererPpapiHost* host, | 43 PepperVideoEncoderHost(RendererPpapiHost* host, |
| 46 PP_Instance instance, | 44 PP_Instance instance, |
| 47 PP_Resource resource); | 45 PP_Resource resource); |
| 48 ~PepperVideoEncoderHost() override; | 46 ~PepperVideoEncoderHost() override; |
| 49 | 47 |
| 50 private: | 48 private: |
| 51 friend class VideoEncoderShim; | 49 friend class VideoEncoderShim; |
| 52 | 50 |
| 53 // Shared memory buffers. | 51 // Shared memory buffers. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 71 void BitstreamBufferReady(int32_t bitstream_buffer_id, | 69 void BitstreamBufferReady(int32_t bitstream_buffer_id, |
| 72 size_t payload_size, | 70 size_t payload_size, |
| 73 bool key_frame) override; | 71 bool key_frame) override; |
| 74 void NotifyError(media::VideoEncodeAccelerator::Error error) override; | 72 void NotifyError(media::VideoEncodeAccelerator::Error error) override; |
| 75 | 73 |
| 76 // ResourceHost implementation. | 74 // ResourceHost implementation. |
| 77 int32_t OnResourceMessageReceived( | 75 int32_t OnResourceMessageReceived( |
| 78 const IPC::Message& msg, | 76 const IPC::Message& msg, |
| 79 ppapi::host::HostMessageContext* context) override; | 77 ppapi::host::HostMessageContext* context) override; |
| 80 | 78 |
| 81 // GpuControlClient implementation. | |
| 82 void OnGpuControlLostContext() final; | |
| 83 void OnGpuControlErrorMessage(const char* msg, int id) final {} | |
| 84 | |
| 85 int32_t OnHostMsgGetSupportedProfiles( | 79 int32_t OnHostMsgGetSupportedProfiles( |
| 86 ppapi::host::HostMessageContext* context); | 80 ppapi::host::HostMessageContext* context); |
| 87 int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context, | 81 int32_t OnHostMsgInitialize(ppapi::host::HostMessageContext* context, |
| 88 PP_VideoFrame_Format input_format, | 82 PP_VideoFrame_Format input_format, |
| 89 const PP_Size& input_visible_size, | 83 const PP_Size& input_visible_size, |
| 90 PP_VideoProfile output_profile, | 84 PP_VideoProfile output_profile, |
| 91 uint32_t initial_bitrate, | 85 uint32_t initial_bitrate, |
| 92 PP_HardwareAcceleration acceleration); | 86 PP_HardwareAcceleration acceleration); |
| 93 int32_t OnHostMsgGetVideoFrames(ppapi::host::HostMessageContext* context); | 87 int32_t OnHostMsgGetVideoFrames(ppapi::host::HostMessageContext* context); |
| 94 int32_t OnHostMsgEncode(ppapi::host::HostMessageContext* context, | 88 int32_t OnHostMsgEncode(ppapi::host::HostMessageContext* context, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Size of the frames allocated for the encoder (matching hardware | 154 // Size of the frames allocated for the encoder (matching hardware |
| 161 // constraints). | 155 // constraints). |
| 162 gfx::Size input_coded_size_; | 156 gfx::Size input_coded_size_; |
| 163 | 157 |
| 164 // Number of frames the encoder needs. | 158 // Number of frames the encoder needs. |
| 165 uint32_t frame_count_; | 159 uint32_t frame_count_; |
| 166 | 160 |
| 167 // Format of the frames to give to the encoder. | 161 // Format of the frames to give to the encoder. |
| 168 media::VideoPixelFormat media_input_format_; | 162 media::VideoPixelFormat media_input_format_; |
| 169 | 163 |
| 170 #if DCHECK_IS_ON() | |
| 171 bool lost_context_ = false; | |
| 172 #endif | |
| 173 | |
| 174 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; | 164 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; |
| 175 | 165 |
| 176 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); | 166 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); |
| 177 }; | 167 }; |
| 178 | 168 |
| 179 } // namespace content | 169 } // namespace content |
| 180 | 170 |
| 181 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ | 171 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ |
| OLD | NEW |