summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi
diff options
context:
space:
mode:
authorvrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-13 18:28:08 +0000
committervrk@google.com <vrk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-13 18:28:08 +0000
commit1357ae79b9d474da177632a85227efb676c6d98e (patch)
tree558938eb3df48430f3864efe2563c848745683cf /webkit/plugins/ppapi
parent2e095c8217b83f2daab9f1b970e943790de6b794 (diff)
downloadchromium_src-1357ae79b9d474da177632a85227efb676c6d98e.zip
chromium_src-1357ae79b9d474da177632a85227efb676c6d98e.tar.gz
chromium_src-1357ae79b9d474da177632a85227efb676c6d98e.tar.bz2
Implement VideoDecoder IPC hooks from plugin to GPU process
This implements the communciation layers from the Renderer process to the GPU process and back for the AcceleratedVideoDecoder PPAPI interfaces. BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6876004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85296 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi')
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc1
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h1
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h1
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.cc51
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.h16
5 files changed, 35 insertions, 35 deletions
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index d4e2296..8103a09 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -41,7 +41,6 @@ MockPluginDelegate::PlatformContext3D* MockPluginDelegate::CreateContext3D() {
MockPluginDelegate::PlatformVideoDecoder*
MockPluginDelegate::CreateVideoDecoder(
- PP_VideoConfigElement* decoder_config,
media::VideoDecodeAccelerator::Client* client) {
return NULL;
}
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index 1259d36..ac3664a 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -22,7 +22,6 @@ class MockPluginDelegate : public PluginDelegate {
virtual PlatformImage2D* CreateImage2D(int width, int height);
virtual PlatformContext3D* CreateContext3D();
virtual PlatformVideoDecoder* CreateVideoDecoder(
- PP_VideoConfigElement* decoder_config,
media::VideoDecodeAccelerator::Client* client);
virtual PlatformAudio* CreateAudio(uint32_t sample_rate,
uint32_t sample_count,
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index d05e8e9..cd714296 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -251,7 +251,6 @@ class PluginDelegate {
// The caller will own the pointer returned from this.
virtual PlatformVideoDecoder* CreateVideoDecoder(
- PP_VideoConfigElement* decoder_config,
media::VideoDecodeAccelerator::Client* client) = 0;
// The caller is responsible for calling Shutdown() on the returned pointer
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
index 6f0c723..5c317ee 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
@@ -138,8 +138,9 @@ const PPB_VideoDecoder_Dev ppb_videodecoder = {
// Utility methods to convert data to and from the ppapi C-types and their
// C++ media-namespace equivalents.
void CopyToPictureDev(const media::Picture& input, PP_Picture_Dev* output) {
+ DCHECK(output);
output->picture_buffer_id = input.picture_buffer_id();
- output->bitstream_user_handle = input.user_handle();
+ output->bitstream_buffer_id = input.bitstream_buffer_id();
output->visible_size =
PP_MakeSize(input.visible_size().width(), input.visible_size().height());
output->decoded_size =
@@ -148,6 +149,8 @@ void CopyToPictureDev(const media::Picture& input, PP_Picture_Dev* output) {
void CopyToConfigList(
const PP_VideoConfigElement* configs, std::vector<uint32>* output) {
+ DCHECK(configs);
+ DCHECK(output);
// TODO(vrk): This is assuming PP_VideoAttributeDictionary and
// VideoAttributeKey have identical enum values. There is no compiler
// assert to guarantee this. We either need to add such asserts or
@@ -214,7 +217,12 @@ bool PPB_VideoDecoder_Impl::Init(PP_VideoConfigElement* decoder_config) {
return false;
platform_video_decoder_.reset(
- instance()->delegate()->CreateVideoDecoder(decoder_config, this));
+ instance()->delegate()->CreateVideoDecoder(this));
+
+ std::vector<uint32> copied;
+ // TODO(vrk): Validate configs before copy.
+ CopyToConfigList(decoder_config, &copied);
+ platform_video_decoder_->Initialize(copied);
return platform_video_decoder_.get()? true : false;
}
@@ -226,20 +234,17 @@ bool PPB_VideoDecoder_Impl::Decode(
return false;
scoped_refptr<PPB_Buffer_Impl> pepper_buffer =
- Resource::GetAs<PPB_Buffer_Impl>(bitstream_buffer->bitstream);
+ Resource::GetAs<PPB_Buffer_Impl>(bitstream_buffer->data);
- media::BitstreamBuffer decode_buffer(pepper_buffer->mapped_buffer(),
- bitstream_buffer->bitstream_size,
- bitstream_buffer->user_handle);
+ media::BitstreamBuffer decode_buffer(bitstream_buffer->id,
+ pepper_buffer->mapped_buffer(),
+ bitstream_buffer->size);
// Store the callback to inform when bitstream buffer has been processed.
// TODO(vmr): handle simultaneous decodes + callbacks.
bitstream_buffer_callback_ = callback;
- return platform_video_decoder_->Decode(
- decode_buffer,
- callback_factory_.NewCallback(
- &PPB_VideoDecoder_Impl::OnBitstreamBufferProcessed));
+ return platform_video_decoder_->Decode(decode_buffer);
}
void PPB_VideoDecoder_Impl::AssignGLESBuffers(
@@ -286,9 +291,7 @@ bool PPB_VideoDecoder_Impl::Flush(PP_CompletionCallback callback) {
// TODO(vmr): Check for current flush/abort operations.
flush_callback_ = callback;
- return platform_video_decoder_->Flush(
- callback_factory_.NewCallback(
- &PPB_VideoDecoder_Impl::OnFlushComplete));
+ return platform_video_decoder_->Flush();
}
bool PPB_VideoDecoder_Impl::Abort(PP_CompletionCallback callback) {
@@ -299,14 +302,12 @@ bool PPB_VideoDecoder_Impl::Abort(PP_CompletionCallback callback) {
// TODO(vmr): Check for current flush/abort operations.
abort_callback_ = callback;
- return platform_video_decoder_->Abort(
- callback_factory_.NewCallback(
- &PPB_VideoDecoder_Impl::OnAbortComplete));
+ return platform_video_decoder_->Abort();
}
void PPB_VideoDecoder_Impl::ProvidePictureBuffers(
uint32 requested_num_of_buffers,
- gfx::Size dimensions,
+ const gfx::Size& dimensions,
media::VideoDecodeAccelerator::MemoryType type) {
if (!ppp_videodecoder_)
return;
@@ -321,8 +322,7 @@ void PPB_VideoDecoder_Impl::ProvidePictureBuffers(
resource.id, requested_num_of_buffers, out_dim, out_type);
}
-void PPB_VideoDecoder_Impl::PictureReady(
- const media::Picture& picture) {
+void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) {
if (!ppp_videodecoder_)
return;
@@ -362,7 +362,7 @@ void PPB_VideoDecoder_Impl::NotifyError(
static_cast<PP_VideoDecodeError_Dev>(error));
}
-void PPB_VideoDecoder_Impl::OnAbortComplete() {
+void PPB_VideoDecoder_Impl::NotifyAbortDone() {
if (abort_callback_.func == NULL)
return;
@@ -372,7 +372,8 @@ void PPB_VideoDecoder_Impl::OnAbortComplete() {
PP_RunCompletionCallback(&callback, PP_OK);
}
-void PPB_VideoDecoder_Impl::OnBitstreamBufferProcessed() {
+void PPB_VideoDecoder_Impl::NotifyEndOfBitstreamBuffer(
+ int32 bitstream_buffer_id) {
if (bitstream_buffer_callback_.func == NULL)
return;
@@ -383,7 +384,7 @@ void PPB_VideoDecoder_Impl::OnBitstreamBufferProcessed() {
PP_RunCompletionCallback(&callback, PP_OK);
}
-void PPB_VideoDecoder_Impl::OnFlushComplete() {
+void PPB_VideoDecoder_Impl::NotifyFlushDone() {
if (flush_callback_.func == NULL)
return;
@@ -400,8 +401,8 @@ void PPB_VideoDecoder_Impl::OnFlushComplete() {
// dependencies (we can't depend on ppapi types from media).
namespace media {
BufferInfo::BufferInfo(const PP_BufferInfo_Dev& info)
- : id_(info.id) {
- size_ = gfx::Size(info.size.width, info.size.height);
+ : id_(info.id),
+ size_(info.size.width, info.size.height) {
}
// TODO(vrk): This assigns the PP_Resource context to be
@@ -423,7 +424,7 @@ SysmemBuffer::SysmemBuffer(const PP_SysmemBuffer_Dev& buffer)
Picture::Picture(const PP_Picture_Dev& picture)
: picture_buffer_id_(picture.picture_buffer_id),
- user_handle_(picture.bitstream_user_handle),
+ bitstream_buffer_id_(picture.bitstream_buffer_id),
visible_size_(picture.visible_size.width, picture.visible_size.height),
decoded_size_(picture.decoded_size.width, picture.decoded_size.height) {
}
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
index 8442c92..85ae9bb 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
@@ -16,6 +16,10 @@
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/resource.h"
+struct PP_GLESBuffer_Dev;
+struct PP_SysmemBuffer_Dev;
+struct PP_VideoDecoderConfig_Dev;
+struct PP_VideoBitstreamBuffer_Dev;
struct PPB_VideoDecoder_Dev;
struct PPP_VideoDecoder_Dev;
@@ -56,20 +60,18 @@ class PPB_VideoDecoder_Impl : public Resource,
// media::VideoDecodeAccelerator::Client implementation.
virtual void ProvidePictureBuffers(
uint32 requested_num_of_buffers,
- gfx::Size dimensions,
+ const gfx::Size& dimensions,
media::VideoDecodeAccelerator::MemoryType type) OVERRIDE;
virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
- virtual void PictureReady(
- const media::Picture& picture) OVERRIDE;
+ virtual void PictureReady(const media::Picture& picture) OVERRIDE;
virtual void NotifyEndOfStream() OVERRIDE;
virtual void NotifyError(
media::VideoDecodeAccelerator::Error error) OVERRIDE;
+ virtual void NotifyFlushDone() OVERRIDE;
+ virtual void NotifyEndOfBitstreamBuffer(int32 buffer_id) OVERRIDE;
+ virtual void NotifyAbortDone() OVERRIDE;
private:
- void OnAbortComplete();
- void OnBitstreamBufferProcessed();
- void OnFlushComplete();
-
// This is NULL before initialization, and if this PPB_VideoDecoder_Impl is
// swapped with another.
scoped_ptr<PluginDelegate::PlatformVideoDecoder> platform_video_decoder_;