summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-17 22:03:16 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-17 22:03:16 +0000
commit1318e92f70e240d7ae71320ea7e4fcae18f2ce3e (patch)
tree412ee9192a850d9867bea3a841d800f67081ebe3 /chrome/renderer
parent9fcd39385ae39a68d3509238bd9ef83af1868fc7 (diff)
downloadchromium_src-1318e92f70e240d7ae71320ea7e4fcae18f2ce3e.zip
chromium_src-1318e92f70e240d7ae71320ea7e4fcae18f2ce3e.tar.gz
chromium_src-1318e92f70e240d7ae71320ea7e4fcae18f2ce3e.tar.bz2
Resubmit GpuVideoDecoder and related patches.
BUG=53714 TEST=Tree is green Review URL: http://codereview.chromium.org/3442006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/gpu_video_decoder_host.cc37
-rw-r--r--chrome/renderer/gpu_video_decoder_host.h1
-rw-r--r--chrome/renderer/media/gles2_video_decode_context.cc13
-rw-r--r--chrome/renderer/media/gles2_video_decode_context.h12
-rw-r--r--chrome/renderer/media/ipc_video_decoder.cc7
5 files changed, 25 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..b7eec02 100644
--- a/chrome/renderer/media/gles2_video_decode_context.cc
+++ b/chrome/renderer/media/gles2_video_decode_context.cc
@@ -20,15 +20,20 @@ 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::UploadToVideoFrame(
+ void* buffer, scoped_refptr<media::VideoFrame> frame, Task* task) {
+ // TODO(hclam): Implement.
+}
+
+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..4f556ab 100644
--- a/chrome/renderer/media/gles2_video_decode_context.h
+++ b/chrome/renderer/media/gles2_video_decode_context.h
@@ -95,10 +95,14 @@ 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 UploadToVideoFrame(void* buffer,
+ scoped_refptr<media::VideoFrame> frame,
+ Task* task);
+ virtual void Destroy(Task* task);
//--------------------------------------------------------------------------
// 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!";