summaryrefslogtreecommitdiff
path: root/content/common/gpu/media/gpu_video_encode_accelerator.h
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2014-04-10 11:22:14 +0100
committerBen Murdoch <benm@google.com>2014-04-10 11:22:14 +0100
commitc5cede9ae108bb15f6b7a8aea21c7e1fefa2834c (patch)
treee9edd581ad60ab80aa5ab423a2a80df652a75792 /content/common/gpu/media/gpu_video_encode_accelerator.h
parent54cd42278ccf1d52996034848086a09b23065a40 (diff)
downloadchromium_org-c5cede9ae108bb15f6b7a8aea21c7e1fefa2834c.tar.gz
Merge from Chromium at DEPS revision 262940
This commit was generated by merge_to_master.py. Change-Id: I9a3fddbb29857fa8f68a18c6a0115862b65f84d1
Diffstat (limited to 'content/common/gpu/media/gpu_video_encode_accelerator.h')
-rw-r--r--content/common/gpu/media/gpu_video_encode_accelerator.h47
1 files changed, 31 insertions, 16 deletions
diff --git a/content/common/gpu/media/gpu_video_encode_accelerator.h b/content/common/gpu/media/gpu_video_encode_accelerator.h
index 5a48295e1e..7b1da6b2fe 100644
--- a/content/common/gpu/media/gpu_video_encode_accelerator.h
+++ b/content/common/gpu/media/gpu_video_encode_accelerator.h
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "content/common/gpu/gpu_command_buffer_stub.h"
#include "ipc/ipc_listener.h"
#include "media/video/video_encode_accelerator.h"
#include "ui/gfx/size.h"
@@ -21,23 +22,29 @@ class SharedMemory;
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 {
+class GpuVideoEncodeAccelerator
+ : public IPC::Listener,
+ public media::VideoEncodeAccelerator::Client,
+ public GpuCommandBufferStub::DestructionObserver {
public:
- GpuVideoEncodeAccelerator(GpuChannel* gpu_channel, int32 route_id);
+ GpuVideoEncodeAccelerator(int32 host_route_id, GpuCommandBufferStub* stub);
virtual ~GpuVideoEncodeAccelerator();
+ // Initialize this accelerator with the given parameters and send
+ // |init_done_msg| when complete.
+ void Initialize(media::VideoFrame::Format input_format,
+ const gfx::Size& input_visible_size,
+ media::VideoCodecProfile output_profile,
+ uint32 initial_bitrate,
+ IPC::Message* init_done_msg);
+
// 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(unsigned int input_count,
const gfx::Size& input_coded_size,
size_t output_buffer_size) OVERRIDE;
@@ -46,6 +53,9 @@ class GpuVideoEncodeAccelerator : public IPC::Listener,
bool key_frame) OVERRIDE;
virtual void NotifyError(media::VideoEncodeAccelerator::Error error) OVERRIDE;
+ // GpuCommandBufferStub::DestructionObserver implementation.
+ virtual void OnWillDestroyStub() OVERRIDE;
+
// Static query for supported profiles. This query calls the appropriate
// platform-specific version.
static std::vector<media::VideoEncodeAccelerator::SupportedProfile>
@@ -57,10 +67,6 @@ class GpuVideoEncodeAccelerator : public IPC::Listener,
// IPC handlers, proxying media::VideoEncodeAccelerator for the renderer
// process.
- void OnInitialize(media::VideoFrame::Format input_format,
- const gfx::Size& input_visible_size,
- media::VideoCodecProfile output_profile,
- uint32 initial_bitrate);
void OnEncode(int32 frame_id,
base::SharedMemoryHandle buffer_handle,
uint32 buffer_size,
@@ -70,19 +76,25 @@ class GpuVideoEncodeAccelerator : public IPC::Listener,
uint32 buffer_size);
void OnRequestEncodingParametersChange(uint32 bitrate, uint32 framerate);
+ void OnDestroy();
+
void EncodeFrameFinished(int32 frame_id, scoped_ptr<base::SharedMemory> shm);
void Send(IPC::Message* message);
+ // Helper for replying to the creation request.
+ void SendCreateEncoderReply(IPC::Message* message, bool succeeded);
- // Weak pointer for media::VideoFrames that refer back to |this|.
- base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_;
+ // Route ID to communicate with the host.
+ int32 host_route_id_;
- // The GpuChannel owns this GpuVideoEncodeAccelerator and will outlive |this|.
- GpuChannel* channel_;
- const int32 route_id_;
+ // Unowned pointer to the underlying GpuCommandBufferStub. |this| is
+ // registered as a DestuctionObserver of |stub_| and will self-delete when
+ // |stub_| is destroyed.
+ GpuCommandBufferStub* stub_;
// Owned pointer to the underlying VideoEncodeAccelerator.
scoped_ptr<media::VideoEncodeAccelerator> encoder_;
+ base::Callback<bool(void)> make_context_current_;
// Video encoding parameters.
media::VideoFrame::Format input_format_;
@@ -90,6 +102,9 @@ class GpuVideoEncodeAccelerator : public IPC::Listener,
gfx::Size input_coded_size_;
size_t output_buffer_size_;
+ // Weak pointer for media::VideoFrames that refer back to |this|.
+ base::WeakPtrFactory<GpuVideoEncodeAccelerator> weak_this_factory_;
+
DISALLOW_COPY_AND_ASSIGN(GpuVideoEncodeAccelerator);
};