| 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> |
| 12 |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 PepperVideoEncoderHost(RendererPpapiHost* host, | 44 PepperVideoEncoderHost(RendererPpapiHost* host, |
| 44 PP_Instance instance, | 45 PP_Instance instance, |
| 45 PP_Resource resource); | 46 PP_Resource resource); |
| 46 ~PepperVideoEncoderHost() override; | 47 ~PepperVideoEncoderHost() override; |
| 47 | 48 |
| 48 private: | 49 private: |
| 49 friend class VideoEncoderShim; | 50 friend class VideoEncoderShim; |
| 50 | 51 |
| 51 // Shared memory buffers. | 52 // Shared memory buffers. |
| 52 struct ShmBuffer { | 53 struct ShmBuffer { |
| 53 ShmBuffer(uint32_t id, scoped_ptr<base::SharedMemory> shm); | 54 ShmBuffer(uint32_t id, std::unique_ptr<base::SharedMemory> shm); |
| 54 ~ShmBuffer(); | 55 ~ShmBuffer(); |
| 55 | 56 |
| 56 media::BitstreamBuffer ToBitstreamBuffer(); | 57 media::BitstreamBuffer ToBitstreamBuffer(); |
| 57 | 58 |
| 58 // Index of the buffer in the ScopedVector. Buffers have the same id in | 59 // Index of the buffer in the ScopedVector. Buffers have the same id in |
| 59 // the plugin and the host. | 60 // the plugin and the host. |
| 60 uint32_t id; | 61 uint32_t id; |
| 61 scoped_ptr<base::SharedMemory> shm; | 62 std::unique_ptr<base::SharedMemory> shm; |
| 62 bool in_use; | 63 bool in_use; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 // media::VideoEncodeAccelerator implementation. | 66 // media::VideoEncodeAccelerator implementation. |
| 66 void RequireBitstreamBuffers(unsigned int input_count, | 67 void RequireBitstreamBuffers(unsigned int input_count, |
| 67 const gfx::Size& input_coded_size, | 68 const gfx::Size& input_coded_size, |
| 68 size_t output_buffer_size) override; | 69 size_t output_buffer_size) override; |
| 69 void BitstreamBufferReady(int32_t bitstream_buffer_id, | 70 void BitstreamBufferReady(int32_t bitstream_buffer_id, |
| 70 size_t payload_size, | 71 size_t payload_size, |
| 71 bool key_frame) override; | 72 bool key_frame) override; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 124 |
| 124 // Non-owning pointer. | 125 // Non-owning pointer. |
| 125 RendererPpapiHost* renderer_ppapi_host_; | 126 RendererPpapiHost* renderer_ppapi_host_; |
| 126 | 127 |
| 127 ScopedVector<ShmBuffer> shm_buffers_; | 128 ScopedVector<ShmBuffer> shm_buffers_; |
| 128 | 129 |
| 129 // Buffer manager for shared memory that holds video frames. | 130 // Buffer manager for shared memory that holds video frames. |
| 130 ppapi::MediaStreamBufferManager buffer_manager_; | 131 ppapi::MediaStreamBufferManager buffer_manager_; |
| 131 | 132 |
| 132 scoped_refptr<gpu::GpuChannelHost> channel_; | 133 scoped_refptr<gpu::GpuChannelHost> channel_; |
| 133 scoped_ptr<gpu::CommandBufferProxyImpl> command_buffer_; | 134 std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_; |
| 134 | 135 |
| 135 scoped_ptr<media::VideoEncodeAccelerator> encoder_; | 136 std::unique_ptr<media::VideoEncodeAccelerator> encoder_; |
| 136 | 137 |
| 137 // Whether the encoder has been successfully initialized. | 138 // Whether the encoder has been successfully initialized. |
| 138 bool initialized_; | 139 bool initialized_; |
| 139 | 140 |
| 140 // Saved context to answer an Initialize message from the plugin. | 141 // Saved context to answer an Initialize message from the plugin. |
| 141 ppapi::host::ReplyMessageContext initialize_reply_context_; | 142 ppapi::host::ReplyMessageContext initialize_reply_context_; |
| 142 | 143 |
| 143 // Saved context to answer a GetVideoFrames message from the plugin. | 144 // Saved context to answer a GetVideoFrames message from the plugin. |
| 144 ppapi::host::ReplyMessageContext get_video_frames_reply_context_; | 145 ppapi::host::ReplyMessageContext get_video_frames_reply_context_; |
| 145 | 146 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 162 media::VideoPixelFormat media_input_format_; | 163 media::VideoPixelFormat media_input_format_; |
| 163 | 164 |
| 164 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; | 165 base::WeakPtrFactory<PepperVideoEncoderHost> weak_ptr_factory_; |
| 165 | 166 |
| 166 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); | 167 DISALLOW_COPY_AND_ASSIGN(PepperVideoEncoderHost); |
| 167 }; | 168 }; |
| 168 | 169 |
| 169 } // namespace content | 170 } // namespace content |
| 170 | 171 |
| 171 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ | 172 #endif // CONTENT_RENDERER_PEPPER_PEPPER_VIDEO_ENCODER_HOST_H_ |
| OLD | NEW |