Index: content/common/gpu/client/ipc/chrome/chrome_gpu_video_encode_accelerator_host_ipc_transport.h |
diff --git a/content/common/gpu/client/ipc/chrome/chrome_gpu_video_encode_accelerator_host_ipc_transport.h b/content/common/gpu/client/ipc/chrome/chrome_gpu_video_encode_accelerator_host_ipc_transport.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2568051a70b50e82b5c2a4316cbdd6b185a33b1c |
--- /dev/null |
+++ b/content/common/gpu/client/ipc/chrome/chrome_gpu_video_encode_accelerator_host_ipc_transport.h |
@@ -0,0 +1,77 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_GPU_CLIENT_IPC_CHROME_CHROME_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_IPC_TRANSPORT_H_ |
+#define CONTENT_COMMON_GPU_CLIENT_IPC_CHROME_CHROME_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_IPC_TRANSPORT_H_ |
+ |
+#include "content/common/gpu/client/ipc/gpu_video_encode_accelerator_host_ipc_transport.h" |
+ |
+#include "ipc/ipc_listener.h" |
+#include "ipc/ipc_sender.h" |
+ |
+namespace content { |
+ |
+class ChromeGpuChannelHostIPCTransport; |
+ |
+class ChromeGpuVideoEncodeAcceleratorHostIPCTransport |
+ : public GpuVideoEncodeAcceleratorHostIPCTransport, |
+ public IPC::Listener, |
+ public IPC::Sender { |
+ public: |
+ static scoped_ptr<GpuVideoEncodeAcceleratorHostIPCTransport> Create(); |
+ |
+ ~ChromeGpuVideoEncodeAcceleratorHostIPCTransport() override; |
+ |
+ void BindToService(ChromeGpuChannelHostIPCTransport* channel_transport); |
+ |
+ base::WeakPtr<ChromeGpuVideoEncodeAcceleratorHostIPCTransport> AsWeakPtr(); |
+ |
+ int32_t route_id() const { return route_id_; } |
+ |
+ private: |
+ ChromeGpuVideoEncodeAcceleratorHostIPCTransport(); |
+ |
+ // IPC::Listener implementation. |
+ void OnChannelError() override; |
+ bool OnMessageReceived(const IPC::Message& message) override; |
+ |
+ // IPC::Sender implementation: |
+ bool Send(IPC::Message* message) override; |
+ |
+ void PostNotifyError(media::VideoEncodeAccelerator::Error error); |
+ |
+ // GpuVideoEncodeAcceleratorHostIPCTransport implementation: |
+ bool Destroy() override; |
+ bool Encode(const content::VideoEncodeParams& params) override; |
+ bool Encode2(const content::VideoEncodeParams2& params) override; |
+ bool RequestEncodingParametersChange(uint32_t bitrate, |
+ uint32_t framerate) override; |
+ void SetClient( |
+ GpuVideoEncodeAcceleratorHostIPCTransport::Client* client) override; |
+ bool UseOutputBitstreamBuffer(int32_t buffer_id, |
+ const base::SharedMemoryHandle& buffer_handle, |
+ uint32_t buffer_size) override; |
+ |
+ // Message handlers. |
+ void OnRequireBitstreamBuffers(uint32_t input_count, |
+ const gfx::Size& input_coded_size, |
+ uint32_t output_buffer_size); |
+ void OnNotifyInputDone(int32_t frame_id); |
+ void OnBitstreamBufferReady(int32_t bitstream_buffer_id, |
+ uint32_t payload_size, |
+ bool key_frame); |
+ void OnNotifyError(media::VideoEncodeAccelerator::Error error); |
+ |
+ ChromeGpuChannelHostIPCTransport* channel_transport_; |
+ int route_id_; |
+ GpuVideoEncodeAcceleratorHostIPCTransport::Client* client_; |
+ base::WeakPtrFactory<ChromeGpuVideoEncodeAcceleratorHostIPCTransport> |
+ weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromeGpuVideoEncodeAcceleratorHostIPCTransport); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_COMMON_GPU_CLIENT_IPC_CHROME_CHROME_GPU_VIDEO_ENCODE_ACCELERATOR_HOST_IPC_TRANSPORT_H_ |