| 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 <memory> | 11 #include <memory> |
| 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_vector.h" | |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "gpu/command_buffer/client/gpu_control_client.h" | 17 #include "gpu/command_buffer/client/gpu_control_client.h" |
| 18 #include "media/video/video_encode_accelerator.h" | 18 #include "media/video/video_encode_accelerator.h" |
| 19 #include "ppapi/c/pp_codecs.h" | 19 #include "ppapi/c/pp_codecs.h" |
| 20 #include "ppapi/c/ppb_video_frame.h" | 20 #include "ppapi/c/ppb_video_frame.h" |
| 21 #include "ppapi/host/host_message_context.h" | 21 #include "ppapi/host/host_message_context.h" |
| 22 #include "ppapi/host/resource_host.h" | 22 #include "ppapi/host/resource_host.h" |
| 23 #include "ppapi/proxy/resource_message_params.h" | 23 #include "ppapi/proxy/resource_message_params.h" |
| 24 #include "ppapi/shared_impl/media_stream_buffer_manager.h" | 24 #include "ppapi/shared_impl/media_stream_buffer_manager.h" |
| 25 | 25 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 46 private: | 46 private: |
| 47 friend class VideoEncoderShim; | 47 friend class VideoEncoderShim; |
| 48 | 48 |
| 49 // Shared memory buffers. | 49 // Shared memory buffers. |
| 50 struct ShmBuffer { | 50 struct ShmBuffer { |
| 51 ShmBuffer(uint32_t id, std::unique_ptr<base::SharedMemory> shm); | 51 ShmBuffer(uint32_t id, std::unique_ptr<base::SharedMemory> shm); |
| 52 ~ShmBuffer(); | 52 ~ShmBuffer(); |
| 53 | 53 |
| 54 media::BitstreamBuffer ToBitstreamBuffer(); | 54 media::BitstreamBuffer ToBitstreamBuffer(); |
| 55 | 55 |
| 56 // Index of the buffer in the ScopedVector. Buffers have the same id in | 56 // Index of the buffer in the |shm_buffers_|. Buffers have the same id in |
| 57 // the plugin and the host. | 57 // the plugin and the host. |
| 58 uint32_t id; | 58 uint32_t id; |
| 59 std::unique_ptr<base::SharedMemory> shm; | 59 std::unique_ptr<base::SharedMemory> shm; |
| 60 bool in_use; | 60 bool in_use; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // media::VideoEncodeAccelerator implementation. | 63 // media::VideoEncodeAccelerator implementation. |
| 64 void RequireBitstreamBuffers(unsigned int input_count, | 64 void RequireBitstreamBuffers(unsigned int input_count, |
| 65 const gfx::Size& input_coded_size, | 65 const gfx::Size& input_coded_size, |
| 66 size_t output_buffer_size) override; | 66 size_t output_buffer_size) override; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void FrameReleased(const ppapi::host::ReplyMessageContext& reply_context, | 121 void FrameReleased(const ppapi::host::ReplyMessageContext& reply_context, |
| 122 uint32_t frame_id); | 122 uint32_t frame_id); |
| 123 void NotifyPepperError(int32_t error); | 123 void NotifyPepperError(int32_t error); |
| 124 | 124 |
| 125 // Helper method for VideoEncoderShim. | 125 // Helper method for VideoEncoderShim. |
| 126 uint8_t* ShmHandleToAddress(int32_t buffer_id); | 126 uint8_t* ShmHandleToAddress(int32_t buffer_id); |
| 127 | 127 |
| 128 // Non-owning pointer. | 128 // Non-owning pointer. |
| 129 RendererPpapiHost* renderer_ppapi_host_; | 129 RendererPpapiHost* renderer_ppapi_host_; |
| 130 | 130 |
| 131 ScopedVector<ShmBuffer> shm_buffers_; | 131 std::vector<std::unique_ptr<ShmBuffer>> shm_buffers_; |
| 132 | 132 |
| 133 // Buffer manager for shared memory that holds video frames. | 133 // Buffer manager for shared memory that holds video frames. |
| 134 ppapi::MediaStreamBufferManager buffer_manager_; | 134 ppapi::MediaStreamBufferManager buffer_manager_; |
| 135 | 135 |
| 136 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | 136 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
| 137 | 137 |
| 138 std::unique_ptr<media::VideoEncodeAccelerator> encoder_; | 138 std::unique_ptr<media::VideoEncodeAccelerator> encoder_; |
| 139 | 139 |
| 140 // Whether the encoder has been successfully initialized. | 140 // Whether the encoder has been successfully initialized. |
| 141 bool initialized_; | 141 bool initialized_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 169 #endif | 169 #endif |
| 170 | 170 |
| 171 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; | 171 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); | 173 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 } // namespace content | 176 } // namespace content |
| 177 | 177 |
| 178 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ | 178 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ |
| OLD | NEW |