Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Unified Diff: content/common/gpu/client/ipc/chrome/chrome_gpu_video_encode_accelerator_host_ipc_transport.h

Issue 1656433002: Sample code: IPC Transport object for GPU Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GpuMemoryBufferService + Transport object. TODO: Eliminate ChildThreadImpl dependency Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698