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

Unified Diff: content/common/gpu/media/gpu_video_encode_accelerator.h

Issue 20632002: Add media::VideoEncodeAccelerator with WebRTC integration (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@git-svn
Patch Set: 7fd9dbd5 More debugging statements, some fixes Created 7 years, 5 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/media/gpu_video_encode_accelerator.h
diff --git a/content/common/gpu/media/gpu_video_encode_accelerator.h b/content/common/gpu/media/gpu_video_encode_accelerator.h
new file mode 100644
index 0000000000000000000000000000000000000000..372a8eb185bddb032b3b69201efdb3c1a4c3fe68
--- /dev/null
+++ b/content/common/gpu/media/gpu_video_encode_accelerator.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2013 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_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
+#define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_
+
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "ipc/ipc_listener.h"
+#include "media/video/video_encode_accelerator.h"
+
+namespace gfx {
+
+class Size;
+
+} // namespace gfx
+
+namespace content {
+
+class GpuChannel;
+
+// This class encapsulates the GPU process view of a VideoEncodeAccelerator,
+// wrapping the platform-specific VideoEncodeAccelerator instance. It handles
+// IPC coming in from the renderer and passes it to the underlying VEA.
+class GpuVideoEncodeAccelerator : public IPC::Listener,
+ public media::VideoEncodeAccelerator::Client {
+ public:
+ GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, int32 route_id);
+ virtual ~GpuVideoEncodeAccelerator();
+
+ // IPC::Listener implementation
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void OnChannelError() OVERRIDE;
+
+ // media::VideoEncodeAccelerator::Client implementation.
+ virtual void NotifyInitializeDone() OVERRIDE;
+ virtual void RequireBitstreamBuffers(int input_count,
+ const gfx::Size& input_dimensions,
+ size_t output_size) OVERRIDE;
+ virtual void NotifyInputDone(int32 bitstream_buffer_id) OVERRIDE;
+ virtual void BitstreamBufferReady(int32 bitstream_buffer_id,
+ size_t payload_size,
+ bool key_frame) OVERRIDE;
+ virtual void NotifyError(media::VideoEncodeAccelerator::Error error) OVERRIDE;
+ // Static query for supported profiles. This query calls the appropriate
Ami GONE FROM CHROMIUM 2013/07/31 23:01:12 comment should be attached to function below, not
sheu 2013/08/02 01:27:49 Done.
+ // platform-specific version.
+
+ static std::vector<media::VideoEncodeAccelerator::SupportedProfile>
+ GetSupportedProfiles();
+
+ private:
+ // Create the appropriate platform-specific VEA.
+ scoped_ptr<media::VideoEncodeAccelerator> CreateEncoder();
Ami GONE FROM CHROMIUM 2013/07/31 23:01:12 This is a member function with a single call-site
sheu 2013/08/02 01:27:49 Used to be a static, not anymore. Done.
+
+ bool Send(IPC::Message* message);
+
+ // IPC handlers.
Ami GONE FROM CHROMIUM 2013/07/31 23:01:12 s/\./ proxying media::VideoEncodeAccelerator./
sheu 2013/08/02 01:27:49 Done.
+ void OnInitialize(media::VideoFrame::Format input_format,
+ const gfx::Size& input_resolution,
+ media::VideoCodecProfile output_profile,
+ int32 initial_bitrate);
+ void OnEncode(int32 buffer_id,
+ base::SharedMemoryHandle buffer_handle,
+ uint32 buffer_size,
+ bool force_keyframe);
+ void OnUseOutputBitstreamBuffer(int32 buffer_id,
+ base::SharedMemoryHandle buffer_handle,
+ uint32 buffer_size);
+ void OnRequestEncodingParameterChange(int32 bitrate);
+
+ // The GpuChannel owns this GpuVideoEncodeAccelerator and will outlive this.
Ami GONE FROM CHROMIUM 2013/07/31 23:01:12 s/this\./|this|./
sheu 2013/08/02 01:27:49 Done.
+ GpuChannel* channel_;
+ const int32 route_id_;
+
+ // Owned pointer to the underlying VideoEncodeAccelerator.
Ami GONE FROM CHROMIUM 2013/07/31 23:01:12 comment doesn't add value but meh.
+ scoped_ptr<media::VideoEncodeAccelerator> encoder_;
+
+ DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator);
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_ENCODE_ACCELERATOR_H_

Powered by Google App Engine
This is Rietveld 408576698