diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 12:46:54 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 12:46:54 +0000 |
commit | 9b98f084607bc1e9185be7f29b52f1e4c0fa498d (patch) | |
tree | 1a742541920858a5cc1d1bb8399a218f53e73392 /chrome/renderer | |
parent | d63b5215c206da43ed352ff09459a0ba3622b727 (diff) | |
download | chromium_src-9b98f084607bc1e9185be7f29b52f1e4c0fa498d.zip chromium_src-9b98f084607bc1e9185be7f29b52f1e4c0fa498d.tar.gz chromium_src-9b98f084607bc1e9185be7f29b52f1e4c0fa498d.tar.bz2 |
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
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59784 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/gpu_video_decoder_host.cc | 37 | ||||
-rw-r--r-- | chrome/renderer/gpu_video_decoder_host.h | 1 | ||||
-rw-r--r-- | chrome/renderer/media/gles2_video_decode_context.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/media/gles2_video_decode_context.h | 9 | ||||
-rw-r--r-- | chrome/renderer/media/ipc_video_decoder.cc | 7 |
5 files changed, 17 insertions, 45 deletions
diff --git a/chrome/renderer/gpu_video_decoder_host.cc b/chrome/renderer/gpu_video_decoder_host.cc index a585ede..771c38a 100644 --- a/chrome/renderer/gpu_video_decoder_host.cc +++ b/chrome/renderer/gpu_video_decoder_host.cc @@ -109,12 +109,9 @@ void GpuVideoDecoderHost::FillThisBuffer(scoped_refptr<VideoFrame> frame) { // TODO(hclam): We should keep an IDMap to convert between a frame a buffer // ID so that we can signal GpuVideoDecoder in GPU process to use the buffer. // This eliminates one conversion step. + // TODO(hclam): Fill the param. GpuVideoDecoderOutputBufferParam param; - // TODO(hclam): This is a hack to pass the texture id to the hardware video - // decoder. We should have created a mapping between VideoFrame and buffer id - // and we pass the buffer id to the GPU process. - param.texture = frame->gl_texture(VideoFrame::kRGBPlane); if (!channel_host_ || !channel_host_->Send( new GpuVideoDecoderMsg_FillThisBuffer(route_id(), param))) { LOG(ERROR) << "GpuVideoDecoderMsg_FillThisBuffer failed"; @@ -152,13 +149,6 @@ void GpuVideoDecoderHost::OnInitializeDone( if (!input_transfer_buffer_->Map(param.input_buffer_size)) break; - if (!base::SharedMemory::IsHandleValid(param.output_buffer_handle)) - break; - output_transfer_buffer_.reset( - new base::SharedMemory(param.output_buffer_handle, false)); - if (!output_transfer_buffer_->Map(param.output_buffer_size)) - break; - success = true; } while (0); @@ -168,7 +158,6 @@ void GpuVideoDecoderHost::OnInitializeDone( void GpuVideoDecoderHost::OnUninitializeDone() { input_transfer_buffer_.reset(); - output_transfer_buffer_.reset(); event_handler_->OnUninitializeDone(); } @@ -189,27 +178,11 @@ void GpuVideoDecoderHost::OnFillThisBufferDone( if (param.flags & GpuVideoDecoderOutputBufferParam::kFlagsEndOfStream) { VideoFrame::CreateEmptyFrame(&frame); - } else if (done_param_.surface_type == - media::VideoFrame::TYPE_SYSTEM_MEMORY) { - VideoFrame::CreateFrame(VideoFrame::YV12, - init_param_.width, - init_param_.height, - base::TimeDelta::FromMicroseconds(param.timestamp), - base::TimeDelta::FromMicroseconds(param.duration), - &frame); - uint8* src = static_cast<uint8*>(output_transfer_buffer_->memory()); - uint8* data0 = frame->data(0); - uint8* data1 = frame->data(1); - uint8* data2 = frame->data(2); - int32 size = init_param_.width * init_param_.height; - memcpy(data0, src, size); - memcpy(data1, src + size, size / 4); - memcpy(data2, src + size + size / 4, size / 4); - } else if (done_param_.surface_type == media::VideoFrame::TYPE_GL_TEXTURE) { + } else { // TODO(hclam): The logic in buffer allocation is pretty much around - // using shared memory for output buffer which needs to be adjusted. For - // now we have to add this hack to get the texture id. - VideoFrame::GlTexture textures[3] = { param.texture, 0, 0 }; + // using shared memory for output buffer which needs to be adjusted. + // Fake the texture ID until we implement it properly. + VideoFrame::GlTexture textures[3] = { 0, 0, 0 }; media::VideoFrame::CreateFrameGlTexture( media::VideoFrame::RGBA, init_param_.width, init_param_.height, textures, diff --git a/chrome/renderer/gpu_video_decoder_host.h b/chrome/renderer/gpu_video_decoder_host.h index 02f8fc8..1255bf5 100644 --- a/chrome/renderer/gpu_video_decoder_host.h +++ b/chrome/renderer/gpu_video_decoder_host.h @@ -112,7 +112,6 @@ class GpuVideoDecoderHost // Transfer buffers for both input and output. // TODO(jiesun): remove output buffer when hardware composition is ready. scoped_ptr<base::SharedMemory> input_transfer_buffer_; - scoped_ptr<base::SharedMemory> output_transfer_buffer_; DISALLOW_COPY_AND_ASSIGN(GpuVideoDecoderHost); }; diff --git a/chrome/renderer/media/gles2_video_decode_context.cc b/chrome/renderer/media/gles2_video_decode_context.cc index 075f80a..2c04282 100644 --- a/chrome/renderer/media/gles2_video_decode_context.cc +++ b/chrome/renderer/media/gles2_video_decode_context.cc @@ -20,15 +20,15 @@ void* Gles2VideoDecodeContext::GetDevice() { } void Gles2VideoDecodeContext::AllocateVideoFrames( - int n, size_t width, size_t height, AllocationCompleteCallback* callback) { + int n, size_t width, size_t height, media::VideoFrame::Format format, + std::vector<scoped_refptr<media::VideoFrame> >* frames, Task* task) { // TODO(hclam): Implement. } -void Gles2VideoDecodeContext::ReleaseVideoFrames(int n, - media::VideoFrame* frames) { +void Gles2VideoDecodeContext::ReleaseAllVideoFrames() { // TODO(hclam): Implement. } -void Gles2VideoDecodeContext::Destroy(DestructionCompleteCallback* callback) { +void Gles2VideoDecodeContext::Destroy(Task* task) { // TODO(hclam): Implement. } diff --git a/chrome/renderer/media/gles2_video_decode_context.h b/chrome/renderer/media/gles2_video_decode_context.h index e087bb3..35958b6 100644 --- a/chrome/renderer/media/gles2_video_decode_context.h +++ b/chrome/renderer/media/gles2_video_decode_context.h @@ -95,10 +95,11 @@ class Gles2VideoDecodeContext : public media::VideoDecodeContext { // media::VideoDecodeContext implementation. virtual void* GetDevice(); - virtual void AllocateVideoFrames(int n, size_t width, size_t height, - AllocationCompleteCallback* callback); - virtual void ReleaseVideoFrames(int n, media::VideoFrame* frames); - virtual void Destroy(DestructionCompleteCallback* callback); + 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) = 0; //-------------------------------------------------------------------------- // Any thread diff --git a/chrome/renderer/media/ipc_video_decoder.cc b/chrome/renderer/media/ipc_video_decoder.cc index 0b6896b..eda8696 100644 --- a/chrome/renderer/media/ipc_video_decoder.cc +++ b/chrome/renderer/media/ipc_video_decoder.cc @@ -111,10 +111,9 @@ void IpcVideoDecoder::OnInitializeDone( media::mime_type::kUncompressedVideo); media_format_.SetAsInteger(media::MediaFormat::kWidth, width_); media_format_.SetAsInteger(media::MediaFormat::kHeight, height_); - media_format_.SetAsInteger(media::MediaFormat::kSurfaceType, - static_cast<int>(param.surface_type)); - media_format_.SetAsInteger(media::MediaFormat::kSurfaceFormat, - static_cast<int>(param.format)); + media_format_.SetAsInteger( + media::MediaFormat::kSurfaceType, + static_cast<int>(media::VideoFrame::TYPE_GL_TEXTURE)); state_ = kPlaying; } else { LOG(ERROR) << "IpcVideoDecoder initialization failed!"; |