Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Unified Diff: content/renderer/pepper_plugin_delegate_impl.cc

Issue 7553003: Video Capture Pepper API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper_plugin_delegate_impl.cc
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index 3edf654bca58ac7d8ed2b9047e781d5eb77e7252..06578b27de0ef14d5d38b8bd2e9c4931faacdfc5 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -33,6 +33,7 @@
#include "content/renderer/gpu/renderer_gl_context.h"
#include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h"
#include "content/renderer/media/audio_message_filter.h"
+#include "content/renderer/media/video_capture_impl_manager.h"
#include "content/renderer/p2p/p2p_transport_impl.h"
#include "content/renderer/pepper_platform_context_3d_impl.h"
#include "content/renderer/pepper_platform_video_decoder_impl.h"
@@ -41,6 +42,7 @@
#include "content/renderer/render_widget_fullscreen_pepper.h"
#include "content/renderer/webplugin_delegate_proxy.h"
#include "ipc/ipc_channel_handle.h"
+#include "media/video/capture/video_capture_proxy.h"
#include "ppapi/c/dev/pp_video_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_flash.h"
@@ -70,8 +72,6 @@ using WebKit::WebView;
namespace {
-const int32 kDefaultCommandBufferSize = 1024 * 1024;
-
int32_t PlatformFileToInt(base::PlatformFile handle) {
#if defined(OS_WIN)
return static_cast<int32_t>(reinterpret_cast<intptr_t>(handle));
@@ -356,6 +356,61 @@ class DispatcherWrapper
scoped_ptr<pp::proxy::HostDispatcher> dispatcher_;
};
+class PlatformVideoCaptureImpl
+ : public webkit::ppapi::PluginDelegate::PlatformVideoCapture {
+ public:
+ PlatformVideoCaptureImpl(media::VideoCapture::EventHandler* handler)
+ : handler_proxy_(new media::VideoCaptureHandlerProxy(
+ handler, base::MessageLoopProxy::CreateForCurrentThread())) {
+ VideoCaptureImplManager* manager =
+ RenderThread::current()->video_capture_impl_manager();
+ video_capture_ = manager->AddDevice(1, handler_proxy_.get());
wjia(left Chromium) 2011/08/02 16:22:28 Is there any plan on device management for pepper?
piman 2011/08/03 00:44:41 Yes, I wanted to look at that at some point. Added
wjia(left Chromium) 2011/08/03 02:40:00 Device enumeration is done in media stream which h
+ }
+
+ // Overrides from media::VideoCapture::EventHandler
+ virtual ~PlatformVideoCaptureImpl() OVERRIDE {
+ VideoCaptureImplManager* manager =
+ RenderThread::current()->video_capture_impl_manager();
+ manager->RemoveDevice(1, handler_proxy_.get());
+ }
+
+ virtual void StartCapture(
+ EventHandler* handler,
+ const VideoCaptureCapability& capability) OVERRIDE {
+ DCHECK(handler == handler_proxy_->proxied());
+ video_capture_->StartCapture(handler_proxy_.get(), capability);
+ }
+
+ virtual void StopCapture(EventHandler* handler) OVERRIDE {
+ DCHECK(handler == handler_proxy_->proxied());
+ video_capture_->StopCapture(handler_proxy_.get());
+ }
+
+ virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE {
+ video_capture_->FeedBuffer(buffer);
+ }
+
+ virtual bool CaptureStarted() OVERRIDE {
+ return handler_proxy_->state().started;
+ }
+
+ virtual int CaptureWidth() OVERRIDE {
+ return handler_proxy_->state().width;
+ }
+
+ virtual int CaptureHeight() OVERRIDE {
+ return handler_proxy_->state().height;
+ }
+
+ virtual int CaptureFrameRate() OVERRIDE {
+ return handler_proxy_->state().frame_rate;
+ }
+
+ private:
+ scoped_ptr<media::VideoCaptureHandlerProxy> handler_proxy_;
+ media::VideoCapture* video_capture_;
+};
+
} // namespace
bool DispatcherWrapper::Init(
@@ -832,6 +887,12 @@ webkit::ppapi::PluginDelegate::PlatformContext3D*
#endif
}
+webkit::ppapi::PluginDelegate::PlatformVideoCapture*
+PepperPluginDelegateImpl::CreateVideoCapture(
+ media::VideoCapture::EventHandler* handler) {
+ return new PlatformVideoCaptureImpl(handler);
+}
+
webkit::ppapi::PluginDelegate::PlatformVideoDecoder*
PepperPluginDelegateImpl::CreateVideoDecoder(
media::VideoDecodeAccelerator::Client* client,

Powered by Google App Engine
This is Rietveld 408576698