diff options
author | mlloyd@chromium.org <mlloyd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 14:19:15 +0000 |
---|---|---|
committer | mlloyd@chromium.org <mlloyd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 14:19:15 +0000 |
commit | dc95389fc803581de77c7fb617b1ef4870c9cbd5 (patch) | |
tree | ec919d1254ff839c690af9e8327e362bff0a9bac /chrome/gpu/gpu_video_decoder.h | |
parent | 425bbb99f4faa4bdf90d9bca09174baa467aeaae (diff) | |
download | chromium_src-dc95389fc803581de77c7fb617b1ef4870c9cbd5.zip chromium_src-dc95389fc803581de77c7fb617b1ef4870c9cbd5.tar.gz chromium_src-dc95389fc803581de77c7fb617b1ef4870c9cbd5.tar.bz2 |
Revert 59784 - GpuVideoDecoder to use GpuVideoDevice and IPC messages to complete VideoFrame allocation
GpuVideoDecedoer now sends IPC messages to allocation GL textures. It also uses
GpuVideoDevice to create VideoFrames from the GL textures. These GL textures
are passed into VideoDecodeEngine.
BUG=53714
TEST=Tree is green
Review URL: http://codereview.chromium.org/3335019
TBR=hclam@chromium.org
Review URL: http://codereview.chromium.org/3451007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59790 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/gpu/gpu_video_decoder.h')
-rw-r--r-- | chrome/gpu/gpu_video_decoder.h | 83 |
1 files changed, 28 insertions, 55 deletions
diff --git a/chrome/gpu/gpu_video_decoder.h b/chrome/gpu/gpu_video_decoder.h index 9f77700..7aabffa 100644 --- a/chrome/gpu/gpu_video_decoder.h +++ b/chrome/gpu/gpu_video_decoder.h @@ -5,9 +5,6 @@ #ifndef CHROME_GPU_GPU_VIDEO_DECODER_H_ #define CHROME_GPU_GPU_VIDEO_DECODER_H_ -#include <map> -#include <vector> - #include "base/basictypes.h" #include "base/callback.h" #include "base/ref_counted.h" @@ -78,8 +75,8 @@ class GpuChannel; // will maintain such mapping. // class GpuVideoDecoder - : public base::RefCountedThreadSafe<GpuVideoDecoder>, - public IPC::Channel::Listener, + : public IPC::Channel::Listener, + public base::RefCountedThreadSafe<GpuVideoDecoder>, public media::VideoDecodeEngine::EventHandler, public media::VideoDecodeContext { @@ -101,11 +98,10 @@ class GpuVideoDecoder // VideoDecodeContext implementation. virtual void* GetDevice(); - virtual void AllocateVideoFrames( - int n, size_t width, size_t height, media::VideoFrame::Format format, - std::vector<scoped_refptr<media::VideoFrame> >* frames, Task* task); - virtual void ReleaseAllVideoFrames(); - virtual void Destroy(Task* task); + virtual void AllocateVideoFrames(int n, size_t width, size_t height, + AllocationCompleteCallback* callback); + virtual void ReleaseVideoFrames(int n, VideoFrame* frames); + virtual void Destroy(DestructionCompleteCallback* callback); // Constructor and destructor. GpuVideoDecoder(const GpuVideoDecoderInfoParam* param, @@ -115,45 +111,19 @@ class GpuVideoDecoder virtual ~GpuVideoDecoder() {} private: - struct PendingAllocation { - size_t n; - size_t width; - size_t height; - media::VideoFrame::Format format; - std::vector<scoped_refptr<media::VideoFrame> >* frames; - Task* task; - }; - int32 route_id() { return decoder_host_route_id_; } bool CreateInputTransferBuffer(uint32 size, base::SharedMemoryHandle* handle); - - // These methods are message handlers for the messages sent from the Renderer - // process. - void OnInitialize(const GpuVideoDecoderInitParam& param); - void OnUninitialize(); - void OnFlush(); - void OnEmptyThisBuffer(const GpuVideoDecoderInputBufferParam& buffer); - void OnFillThisBuffer(const GpuVideoDecoderOutputBufferParam& param); - void OnFillThisBufferDoneACK(); - void OnVideoFrameAllocated(int32 frame_id, std::vector<uint32> textures); - - // Helper methods for sending messages to the Renderer process. - void SendInitializeDone(const GpuVideoDecoderInitDoneParam& param); - void SendUninitializeDone(); - void SendFlushDone(); - void SendEmptyBufferDone(); - void SendEmptyBufferACK(); - void SendFillBufferDone(const GpuVideoDecoderOutputBufferParam& param); - void SendAllocateVideoFrames( - int n, size_t width, size_t height, media::VideoFrame::Format format); - void SendReleaseAllVideoFrames(); + bool CreateOutputTransferBuffer(uint32 size, + base::SharedMemoryHandle* handle); + void CreateVideoFrameOnTransferBuffer(); int32 decoder_host_route_id_; // Used only in system memory path. i.e. Remove this later. scoped_refptr<VideoFrame> frame_; + bool output_transfer_buffer_busy_; int32 pending_output_requests_; GpuChannel* channel_; @@ -163,27 +133,30 @@ class GpuVideoDecoder // is used to switch context and translate client texture ID to service ID. gpu::gles2::GLES2Decoder* gles2_decoder_; - // Memory for transfering the input data for the hardware video decoder. scoped_ptr<base::SharedMemory> input_transfer_buffer_; + scoped_ptr<base::SharedMemory> output_transfer_buffer_; - // VideoDecodeEngine is used to do the actual video decoding. scoped_ptr<media::VideoDecodeEngine> decode_engine_; - - // GpuVideoDevice is used to generate VideoFrame(s) from GL textures. The - // frames generated are understood by the decode engine. - scoped_ptr<GpuVideoDevice> video_device_; - - // Contain information for allocation VideoFrame(s). - scoped_ptr<PendingAllocation> pending_allocation_; - - // Contains the mapping between a |frame_id| and VideoFrame generated by - // GpuVideoDevice from the associated GL textures. - typedef std::map<int32, scoped_refptr<media::VideoFrame> > VideoFrameMap; - VideoFrameMap video_frame_map_; - + scoped_ptr<GpuVideoDevice> decode_context_; media::VideoCodecConfig config_; media::VideoCodecInfo info_; + // Input message handler. + void OnInitialize(const GpuVideoDecoderInitParam& param); + void OnUninitialize(); + void OnFlush(); + void OnEmptyThisBuffer(const GpuVideoDecoderInputBufferParam& buffer); + void OnFillThisBuffer(const GpuVideoDecoderOutputBufferParam& param); + void OnFillThisBufferDoneACK(); + + // Output message helper. + void SendInitializeDone(const GpuVideoDecoderInitDoneParam& param); + void SendUninitializeDone(); + void SendFlushDone(); + void SendEmptyBufferDone(); + void SendEmptyBufferACK(); + void SendFillBufferDone(const GpuVideoDecoderOutputBufferParam& param); + DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoder); }; |