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

Unified Diff: content/renderer/media/video_destination_handler.h

Issue 14312015: Effects Pepper Plugin and MediaStream Glue. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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/media/video_destination_handler.h
===================================================================
--- content/renderer/media/video_destination_handler.h (revision 0)
+++ content/renderer/media/video_destination_handler.h (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_
+#define CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/synchronization/lock.h"
+#include "content/common/content_export.h"
+#include "third_party/libjingle/source/talk/media/base/videocapturer.h"
+
+namespace webkit {
+namespace ppapi {
+class PPB_ImageData_Impl;
+}
+}
+
+namespace content {
+
+class MediaStreamDependencyFactory;
+class MediaStreamRegistryInterface;
+
+// Interface used by the effects pepper plugin to output the processed frame
+// to the video track.
+class CONTENT_EXPORT FrameWriterInterface {
+ public:
+ // The ownership of the |image_data| deosn't transfer. So the implementation
+ // of this interface should make a copy of the |image_data| before return.
+ virtual void PutFrame(webkit::ppapi::PPB_ImageData_Impl* image_data,
wjia(left Chromium) 2013/05/03 21:42:55 const webkit::ppapi::PPB_ImageData_Impl& image_dat
Ronghua Wu (Left Chromium) 2013/05/03 22:40:02 I can't actually. Before using the PPB_ImageData_I
+ int64 time_stamp_ns) = 0;
+ virtual ~FrameWriterInterface() {}
+};
+
+// PpFrameWriter implements cricket::VideoCapturer so that it can be used in
+// the native video track's video source. It also implements
+// FrameWriterInterface, which will be used by the effects pepper plugin to
+// inject the processed frame.
+class CONTENT_EXPORT PpFrameWriter
+ : public NON_EXPORTED_BASE(cricket::VideoCapturer),
+ public FrameWriterInterface {
+ public:
+ PpFrameWriter();
+ virtual ~PpFrameWriter();
+
+ // cricket::VideoCapturer implementation.
+ // These methods are accessed from a libJingle worker thread.
+ virtual cricket::CaptureState Start(
+ const cricket::VideoFormat& capture_format) OVERRIDE;
+ virtual void Stop() OVERRIDE;
+ virtual bool IsRunning() OVERRIDE;
+ virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs) OVERRIDE;
+ virtual bool GetBestCaptureFormat(const cricket::VideoFormat& desired,
+ cricket::VideoFormat* best_format) OVERRIDE;
+ virtual bool IsScreencast() const OVERRIDE;
+
+ // FrameWriterInterface implementation.
+ // This method will be called by the Pepper host from render thread.
+ virtual void PutFrame(webkit::ppapi::PPB_ImageData_Impl* image_data,
+ int64 time_stamp_ns) OVERRIDE;
+
+ private:
+ bool started_;
+ base::Lock lock_;
wjia(left Chromium) 2013/05/03 21:42:55 Please add comment on which is protected by this |
Ronghua Wu (Left Chromium) 2013/05/03 22:40:02 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(PpFrameWriter);
+};
+
+// VideoDestinationHandler is a glue class between the webrtc MediaStream and
+// the effects pepper plugin host.
+class CONTENT_EXPORT VideoDestinationHandler {
+ public:
+ // Instantiates and adds a new video track to the MediaStream specified by
+ // |url|. Returns a handler for delivering frames to the new video track as
+ // |frame_writer|.
+ // The caller of the function takes the ownership of |frame_writer|.
+ // Returns true on success and false on failure.
wjia(left Chromium) 2013/05/03 21:42:55 Could you add some comments on what are |factory|
Ronghua Wu (Left Chromium) 2013/05/03 22:40:02 Added comments. And change the code a bit so that
+ static bool Open(MediaStreamDependencyFactory* factory,
+ MediaStreamRegistryInterface* registry,
+ const std::string& url,
+ FrameWriterInterface** frame_writer);
wjia(left Chromium) 2013/05/03 21:42:55 Is it possible to use frame_writer==NULL as indica
Ronghua Wu (Left Chromium) 2013/05/03 22:40:02 I prefer to keep as it's to align with the other O
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(VideoDestinationHandler);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_
+
Property changes on: content/renderer/media/video_destination_handler.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698