summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/gpu_video_decoder_host.h
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 09:30:07 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-29 09:30:07 +0000
commit63b39c73dd951416f6c1808f34a10ca422336610 (patch)
tree23346799369839cf51e1d831f9d97de1629934d0 /chrome/renderer/gpu_video_decoder_host.h
parentddaa08c97c8a0f35d709d5fd1191b093fbae1c36 (diff)
downloadchromium_src-63b39c73dd951416f6c1808f34a10ca422336610.zip
chromium_src-63b39c73dd951416f6c1808f34a10ca422336610.tar.gz
chromium_src-63b39c73dd951416f6c1808f34a10ca422336610.tar.bz2
Revert 60912 - Some cleanup work in GpuVideoDecoderHost and IpcVideoDecoder
Seeing that GpuVideoDecoderHost has a very similar interface to VideoDecodeEngine, this patch makes GpuVideoDecoderHost implments VideoDecodeEngine. Also did some cleanup work to remove code patch that doesn't fit into the buffer allocation model we are moving to. BUG=53714 TEST=Tree is green. Code still doesn't work yet. Review URL: http://codereview.chromium.org/3393014 TBR=hclam@chromium.org Review URL: http://codereview.chromium.org/3531002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/gpu_video_decoder_host.h')
-rw-r--r--chrome/renderer/gpu_video_decoder_host.h83
1 files changed, 36 insertions, 47 deletions
diff --git a/chrome/renderer/gpu_video_decoder_host.h b/chrome/renderer/gpu_video_decoder_host.h
index 68953f6..cfcdf88 100644
--- a/chrome/renderer/gpu_video_decoder_host.h
+++ b/chrome/renderer/gpu_video_decoder_host.h
@@ -10,64 +10,59 @@
#include "base/singleton.h"
#include "chrome/common/gpu_video_common.h"
#include "chrome/renderer/gpu_channel_host.h"
-#include "ipc/ipc_message.h"
+#include "ipc/ipc_channel_proxy.h"
#include "media/base/buffers.h"
#include "media/base/video_frame.h"
-#include "media/video/video_decode_engine.h"
using media::VideoFrame;
using media::Buffer;
class GpuVideoServiceHost;
-// This class is used to talk to GpuVideoDecoder in the GPU process through
-// IPC messages. It implements the interface of VideoDecodeEngine so users
-// view it as a regular video decode engine, the implementation is a portal
-// to the GPU process.
-//
-// THREAD SEMANTICS
-//
-// All methods of this class can be accessed on any thread. A message loop
-// needs to be provided to class through Initialize() for accessing the
-// IPC channel. Event handlers are called on that message loop.
-//
-// Since this class is not refcounted, it is important to delete this
-// object only after OnUninitializeCompelte() is called.
-class GpuVideoDecoderHost : public media::VideoDecodeEngine,
- public IPC::Channel::Listener {
+class GpuVideoDecoderHost
+ : public base::RefCountedThreadSafe<GpuVideoDecoderHost>,
+ public IPC::Channel::Listener {
public:
- virtual ~GpuVideoDecoderHost() {}
+ class EventHandler {
+ public:
+ virtual void OnInitializeDone(
+ bool success,
+ const GpuVideoDecoderInitDoneParam& param) = 0;
+ virtual void OnUninitializeDone() = 0;
+ virtual void OnFlushDone() = 0;
+ virtual void OnEmptyBufferDone(scoped_refptr<Buffer> buffer) = 0;
+ virtual void OnFillBufferDone(scoped_refptr<VideoFrame> frame) = 0;
+ virtual void OnDeviceError() = 0;
+ };
+
+ typedef enum {
+ kStateUninitialized,
+ kStateNormal,
+ kStateError,
+ kStateFlushing,
+ } GpuVideoDecoderHostState;
// IPC::Channel::Listener.
virtual void OnChannelConnected(int32 peer_pid) {}
virtual void OnChannelError();
virtual void OnMessageReceived(const IPC::Message& message);
- // media::VideoDecodeEngine implementation.
- virtual void Initialize(MessageLoop* message_loop,
- VideoDecodeEngine::EventHandler* event_handler,
- media::VideoDecodeContext* context,
- const media::VideoCodecConfig& config);
- virtual void ConsumeVideoSample(scoped_refptr<Buffer> buffer);
- virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> frame);
- virtual void Uninitialize();
- virtual void Flush();
- virtual void Seek();
+ bool Initialize(EventHandler* handler, const GpuVideoDecoderInitParam& param);
+ bool Uninitialize();
+ void EmptyThisBuffer(scoped_refptr<Buffer> buffer);
+ void FillThisBuffer(scoped_refptr<VideoFrame> frame);
+ bool Flush();
- private:
- friend class GpuVideoServiceHost;
+ int32 decoder_id() { return decoder_info_.decoder_id; }
+ int32 route_id() { return decoder_info_.decoder_route_id; }
+ int32 my_route_id() { return decoder_info_.decoder_host_route_id; }
- // Internal states.
- enum GpuVideoDecoderHostState {
- kStateUninitialized,
- kStateNormal,
- kStateError,
- kStateFlushing,
- };
+ virtual ~GpuVideoDecoderHost() {}
- // Private constructor.
+ private:
+ friend class GpuVideoServiceHost;
GpuVideoDecoderHost(GpuVideoServiceHost* service_host,
- IPC::Message::Sender* ipc_sender,
+ GpuChannelHost* channel_host,
int context_route_id);
// Input message handler.
@@ -82,16 +77,10 @@ class GpuVideoDecoderHost : public media::VideoDecodeEngine,
// Helper function.
void SendInputBufferToGpu();
- // Getter methods for IDs.
- int32 decoder_id() { return decoder_info_.decoder_id; }
- int32 route_id() { return decoder_info_.decoder_route_id; }
- int32 my_route_id() { return decoder_info_.decoder_host_route_id; }
-
// We expect that GpuVideoServiceHost's always available during our life span.
GpuVideoServiceHost* gpu_video_service_host_;
- // Sends IPC messages to the GPU process.
- IPC::Message::Sender* ipc_sender_;
+ GpuChannelHost* channel_host_;
// Route ID of the GLES2 context in the GPU process.
int context_route_id_;
@@ -106,7 +95,7 @@ class GpuVideoDecoderHost : public media::VideoDecodeEngine,
int32 buffer_id_serial_;
// Hold information about GpuVideoDecoder configuration.
- media::VideoCodecConfig config_;
+ GpuVideoDecoderInitParam init_param_;
// Hold information about output surface format, etc.
GpuVideoDecoderInitDoneParam done_param_;