summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/common/gpu/gpu_messages.h3
-rw-r--r--content/common/gpu/gpu_video_decode_accelerator.cc5
-rw-r--r--content/common/gpu/gpu_video_decode_accelerator.h7
-rw-r--r--content/renderer/gpu_video_decode_accelerator_host.cc6
-rw-r--r--content/renderer/gpu_video_decode_accelerator_host.h1
-rw-r--r--content/renderer/gpu_video_service_host.cc1
-rw-r--r--content/renderer/pepper_platform_video_decoder_impl.cc7
-rw-r--r--content/renderer/pepper_platform_video_decoder_impl.h1
-rw-r--r--media/video/video_decode_accelerator.h3
-rw-r--r--ppapi/c/dev/ppb_video_decoder_dev.h8
-rw-r--r--ppapi/cpp/dev/video_decoder_dev.cc1
-rw-r--r--ppapi/cpp/dev/video_decoder_dev.h3
-rw-r--r--ppapi/tests/test_video_decoder.cc2
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.cc21
-rw-r--r--webkit/plugins/ppapi/ppb_video_decoder_impl.h4
15 files changed, 58 insertions, 15 deletions
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index c4db8f1..2ddd0de 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -606,6 +606,9 @@ IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers,
IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_CreateDone,
int32) /* Decoder ID */
+// Notify client that decoder has been initialized.
+IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_InitializeDone)
+
// Decoder reports that a picture is ready and buffer does not need to be passed
// back to the decoder.
IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_DismissPictureBuffer,
diff --git a/content/common/gpu/gpu_video_decode_accelerator.cc b/content/common/gpu/gpu_video_decode_accelerator.cc
index e962968..74dae55d 100644
--- a/content/common/gpu/gpu_video_decode_accelerator.cc
+++ b/content/common/gpu/gpu_video_decode_accelerator.cc
@@ -173,6 +173,11 @@ void GpuVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer(
}
}
+void GpuVideoDecodeAccelerator::NotifyInitializeDone() {
+ if (!Send(new AcceleratedVideoDecoderHostMsg_InitializeDone(route_id_)))
+ LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_InitializeDone) failed";
+}
+
void GpuVideoDecodeAccelerator::NotifyFlushDone() {
if (!Send(new AcceleratedVideoDecoderHostMsg_FlushDone(route_id_)))
LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed";
diff --git a/content/common/gpu/gpu_video_decode_accelerator.h b/content/common/gpu/gpu_video_decode_accelerator.h
index 584e3de..cef9061 100644
--- a/content/common/gpu/gpu_video_decode_accelerator.h
+++ b/content/common/gpu/gpu_video_decode_accelerator.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_
-#define CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_
+#ifndef CONTENT_COMMON_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_
+#define CONTENT_COMMON_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_
#include <vector>
@@ -34,6 +34,7 @@ class GpuVideoDecodeAccelerator
media::VideoDecodeAccelerator::MemoryType type) OVERRIDE;
virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
virtual void PictureReady(const media::Picture& picture) OVERRIDE;
+ virtual void NotifyInitializeDone() OVERRIDE;
virtual void NotifyEndOfStream() OVERRIDE;
virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE;
virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE;
@@ -77,4 +78,4 @@ class GpuVideoDecodeAccelerator
DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator);
};
-#endif // CONTENT_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_
+#endif // CONTENT_COMMON_GPU_GPU_VIDEO_DECODE_ACCELERATOR_H_
diff --git a/content/renderer/gpu_video_decode_accelerator_host.cc b/content/renderer/gpu_video_decode_accelerator_host.cc
index 2b2d027..7da137f 100644
--- a/content/renderer/gpu_video_decode_accelerator_host.cc
+++ b/content/renderer/gpu_video_decode_accelerator_host.cc
@@ -46,6 +46,8 @@ bool GpuVideoDecodeAcceleratorHost::OnMessageReceived(const IPC::Message& msg) {
OnProvidePictureBuffer)
IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_CreateDone,
OnCreateDone)
+ IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_InitializeDone,
+ OnInitializeDone)
IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_PictureReady,
OnPictureReady)
IPC_MESSAGE_HANDLER(AcceleratedVideoDecoderHostMsg_FlushDone,
@@ -175,6 +177,10 @@ void GpuVideoDecodeAcceleratorHost::OnCreateDone(int32 decoder_id) {
}
}
+void GpuVideoDecodeAcceleratorHost::OnInitializeDone() {
+ client_->NotifyInitializeDone();
+}
+
void GpuVideoDecodeAcceleratorHost::OnPictureReady(
int32 picture_buffer_id, int32 bitstream_buffer_id,
const gfx::Size& visible_size, const gfx::Size& decoded_size) {
diff --git a/content/renderer/gpu_video_decode_accelerator_host.h b/content/renderer/gpu_video_decode_accelerator_host.h
index 4503f55..8a984f3 100644
--- a/content/renderer/gpu_video_decode_accelerator_host.h
+++ b/content/renderer/gpu_video_decode_accelerator_host.h
@@ -53,6 +53,7 @@ class GpuVideoDecodeAcceleratorHost : public IPC::Channel::Listener,
uint32 num_requested_buffers, const gfx::Size& buffer_size, int32 mem_type);
void OnDismissPictureBuffer(int32 picture_buffer_id);
void OnCreateDone(int32 decoder_id);
+ void OnInitializeDone();
void OnPictureReady(int32 picture_buffer_id,
int32 bitstream_buffer_id,
const gfx::Size& visible_size,
diff --git a/content/renderer/gpu_video_service_host.cc b/content/renderer/gpu_video_service_host.cc
index 78f2dcc..eeedb9a 100644
--- a/content/renderer/gpu_video_service_host.cc
+++ b/content/renderer/gpu_video_service_host.cc
@@ -42,6 +42,7 @@ bool GpuVideoServiceHost::OnMessageReceived(const IPC::Message& msg) {
case AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed::ID:
case AcceleratedVideoDecoderHostMsg_ProvidePictureBuffers::ID:
case AcceleratedVideoDecoderHostMsg_CreateDone::ID:
+ case AcceleratedVideoDecoderHostMsg_InitializeDone::ID:
case AcceleratedVideoDecoderHostMsg_DismissPictureBuffer::ID:
case AcceleratedVideoDecoderHostMsg_PictureReady::ID:
case AcceleratedVideoDecoderHostMsg_FlushDone::ID:
diff --git a/content/renderer/pepper_platform_video_decoder_impl.cc b/content/renderer/pepper_platform_video_decoder_impl.cc
index 7d46cf4..b12d565 100644
--- a/content/renderer/pepper_platform_video_decoder_impl.cc
+++ b/content/renderer/pepper_platform_video_decoder_impl.cc
@@ -51,9 +51,6 @@ bool PlatformVideoDecoderImpl::Initialize(const std::vector<uint32>& config) {
// Set a callback to ensure decoder is only initialized after channel is
// connected and GpuVidoServiceHost message filter is added to channel.
- //
- // TODO(vrk): Initialize should take a callback to be called (on the
- // renderer's thread) when initialization is completed.
base::Closure initialize = base::Bind(
&PlatformVideoDecoderImpl::InitializeDecoder,
base::Unretained(this),
@@ -139,6 +136,10 @@ void PlatformVideoDecoderImpl::PictureReady(const media::Picture& picture) {
client_->PictureReady(picture);
}
+void PlatformVideoDecoderImpl::NotifyInitializeDone() {
+ client_->NotifyInitializeDone();
+}
+
void PlatformVideoDecoderImpl::NotifyEndOfBitstreamBuffer(
int32 bitstream_buffer_id) {
client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id);
diff --git a/content/renderer/pepper_platform_video_decoder_impl.h b/content/renderer/pepper_platform_video_decoder_impl.h
index dd04b80..4588ea7 100644
--- a/content/renderer/pepper_platform_video_decoder_impl.h
+++ b/content/renderer/pepper_platform_video_decoder_impl.h
@@ -45,6 +45,7 @@ class PlatformVideoDecoderImpl
media::VideoDecodeAccelerator::MemoryType type) OVERRIDE;
virtual void PictureReady(const media::Picture& picture) OVERRIDE;
virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
+ virtual void NotifyInitializeDone() OVERRIDE;
virtual void NotifyEndOfStream() OVERRIDE;
virtual void NotifyError(
media::VideoDecodeAccelerator::Error error) OVERRIDE;
diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h
index 807f923..807501f 100644
--- a/media/video/video_decode_accelerator.h
+++ b/media/video/video_decode_accelerator.h
@@ -186,6 +186,9 @@ class VideoDecodeAccelerator {
public:
virtual ~Client() {}
+ // Callback to notify client that decoder has been initialized.
+ virtual void NotifyInitializeDone() = 0;
+
// Callback to tell the information needed by the client to provide decoding
// buffer to the decoder.
virtual void ProvidePictureBuffers(
diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h
index 8cf9851..46eded5 100644
--- a/ppapi/c/dev/ppb_video_decoder_dev.h
+++ b/ppapi/c/dev/ppb_video_decoder_dev.h
@@ -9,8 +9,8 @@
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_var.h"
-#define PPB_VIDEODECODER_DEV_INTERFACE_0_7 "PPB_VideoDecoder(Dev);0.7"
-#define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_7
+#define PPB_VIDEODECODER_DEV_INTERFACE_0_8 "PPB_VideoDecoder(Dev);0.8"
+#define PPB_VIDEODECODER_DEV_INTERFACE PPB_VIDEODECODER_DEV_INTERFACE_0_8
// Video decoder interface.
//
@@ -131,10 +131,12 @@ struct PPB_VideoDecoder_Dev {
// Parameters:
// |instance| pointer to the plugin instance.
// |dec_config| the configuration which to use to initialize the decoder.
+ // |callback| called after initialize is complete.
//
// The created decoder is returned as PP_Resource. NULL means failure.
PP_Resource (*Create)(PP_Instance instance,
- PP_VideoConfigElement* dec_config);
+ PP_VideoConfigElement* dec_config,
+ struct PP_CompletionCallback callback);
// Tests whether |resource| is a video decoder created through Create
// function of this interface.
diff --git a/ppapi/cpp/dev/video_decoder_dev.cc b/ppapi/cpp/dev/video_decoder_dev.cc
index 1749ab0..504530a 100644
--- a/ppapi/cpp/dev/video_decoder_dev.cc
+++ b/ppapi/cpp/dev/video_decoder_dev.cc
@@ -26,6 +26,7 @@ template <> const char* interface_name<PPB_VideoDecoder_Dev>() {
VideoDecoder::VideoDecoder(const Instance* /* instance */,
const std::vector<uint32_t>& /* config */,
+ CompletionCallback /* callback */,
Client* client)
: client_(client) {
if (!has_interface<PPB_VideoDecoder_Dev>())
diff --git a/ppapi/cpp/dev/video_decoder_dev.h b/ppapi/cpp/dev/video_decoder_dev.h
index ff7be2a..ba29aba 100644
--- a/ppapi/cpp/dev/video_decoder_dev.h
+++ b/ppapi/cpp/dev/video_decoder_dev.h
@@ -54,10 +54,11 @@ class VideoDecoder : public Resource {
// Parameters:
// |instance| is the pointer to the plug-in instance.
// |config| is the configuration on which the decoder should be initialized.
+ // |callback| will be called when decoder is initialized.
// |client| is the pointer to the client object. Ownership of the object is
// not transferred and it must outlive the lifetime of this class.
VideoDecoder(const Instance* instance, const std::vector<uint32_t>& config,
- Client* client);
+ CompletionCallback callback, Client* client);
~VideoDecoder();
// GetConfigs returns supported configurations that are subsets of given
diff --git a/ppapi/tests/test_video_decoder.cc b/ppapi/tests/test_video_decoder.cc
index 4279894..db0da55 100644
--- a/ppapi/tests/test_video_decoder.cc
+++ b/ppapi/tests/test_video_decoder.cc
@@ -29,7 +29,7 @@ void TestVideoDecoder::QuitMessageLoop() {
std::string TestVideoDecoder::TestCreate() {
PP_Resource decoder = video_decoder_interface_->Create(
- instance_->pp_instance(), NULL);
+ instance_->pp_instance(), NULL, PP_MakeCompletionCallback(NULL, NULL));
if (decoder == 0) {
return "Error creating the decoder";
}
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
index 76edf08..7cc37ba 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.cc
@@ -44,7 +44,8 @@ PP_Bool GetConfigs(PP_Instance instance_id,
}
PP_Resource Create(PP_Instance instance_id,
- PP_VideoConfigElement* decoder_config) {
+ PP_VideoConfigElement* decoder_config,
+ PP_CompletionCallback callback) {
PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
if (!instance)
return 0;
@@ -52,8 +53,10 @@ PP_Resource Create(PP_Instance instance_id,
scoped_refptr<PPB_VideoDecoder_Impl> decoder(
new PPB_VideoDecoder_Impl(instance));
- if (!decoder->Init(const_cast<PP_VideoConfigElement*>(decoder_config)))
+ if (!decoder->Init(
+ const_cast<PP_VideoConfigElement*>(decoder_config), callback)) {
return 0;
+ }
return decoder->GetReference();
}
@@ -212,7 +215,8 @@ bool PPB_VideoDecoder_Impl::GetConfigs(
return true;
}
-bool PPB_VideoDecoder_Impl::Init(PP_VideoConfigElement* decoder_config) {
+bool PPB_VideoDecoder_Impl::Init(PP_VideoConfigElement* decoder_config,
+ PP_CompletionCallback callback) {
if (!instance())
return false;
@@ -224,6 +228,8 @@ bool PPB_VideoDecoder_Impl::Init(PP_VideoConfigElement* decoder_config) {
CopyToConfigList(decoder_config, &copied);
platform_video_decoder_->Initialize(copied);
+ initialization_callback_ = callback;
+
return platform_video_decoder_.get()? true : false;
}
@@ -392,6 +398,15 @@ void PPB_VideoDecoder_Impl::NotifyFlushDone() {
PP_RunCompletionCallback(&callback, PP_OK);
}
+void PPB_VideoDecoder_Impl::NotifyInitializeDone() {
+ if (initialization_callback_.func == NULL)
+ return;
+
+ PP_CompletionCallback callback = PP_BlockUntilComplete();
+ std::swap(callback, initialization_callback_);
+ PP_RunCompletionCallback(&callback, PP_OK);
+}
+
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
index 85ae9bb..3bc2690 100644
--- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h
+++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.h
@@ -46,7 +46,7 @@ class PPB_VideoDecoder_Impl : public Resource,
PP_VideoConfigElement* matching_configs,
uint32_t matching_configs_size,
uint32_t* num_of_matching_configs);
- bool Init(PP_VideoConfigElement* dec_config);
+ bool Init(PP_VideoConfigElement* dec_config, PP_CompletionCallback callback);
bool Decode(PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
PP_CompletionCallback callback);
void AssignGLESBuffers(uint32_t no_of_buffers,
@@ -64,6 +64,7 @@ class PPB_VideoDecoder_Impl : public Resource,
media::VideoDecodeAccelerator::MemoryType type) OVERRIDE;
virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE;
virtual void PictureReady(const media::Picture& picture) OVERRIDE;
+ virtual void NotifyInitializeDone() OVERRIDE;
virtual void NotifyEndOfStream() OVERRIDE;
virtual void NotifyError(
media::VideoDecodeAccelerator::Error error) OVERRIDE;
@@ -79,6 +80,7 @@ class PPB_VideoDecoder_Impl : public Resource,
// Factory to produce our callbacks.
base::ScopedCallbackFactory<PPB_VideoDecoder_Impl> callback_factory_;
+ PP_CompletionCallback initialization_callback_;
PP_CompletionCallback abort_callback_;
PP_CompletionCallback flush_callback_;
PP_CompletionCallback bitstream_buffer_callback_;