Chromium Code Reviews| Index: content/renderer/media/video_source_handler.h |
| =================================================================== |
| --- content/renderer/media/video_source_handler.h (revision 0) |
| +++ content/renderer/media/video_source_handler.h (revision 0) |
| @@ -0,0 +1,81 @@ |
| +// 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_SOURCE_HANDLER_H_ |
| +#define CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/synchronization/lock.h" |
| +#include "content/common/content_export.h" |
| +#include "content/renderer/media/media_stream_registry_interface.h" |
| +#include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" |
| +#include "third_party/libjingle/source/talk/media/base/videoframe.h" |
| +#include "third_party/libjingle/source/talk/media/base/videorenderer.h" |
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" |
| + |
| +namespace content { |
| + |
| +class MediaStreamDependencyFactory; |
| +class MediaStreamRegistryInterface; |
| + |
| +// Interface used by the effects pepper plugin to get captured frame |
| +// from the video track. |
| +class CONTENT_EXPORT FrameReaderInterface { |
| + public: |
| + // The ownership of the |frame| transfers to the caller. So the caller must |
| + // release |frame| when done with it. |
| + virtual bool GetFrame(cricket::VideoFrame** frame) = 0; |
|
wjia(left Chromium)
2013/04/30 18:32:11
Any reason for pull model here? How does the plugi
Ronghua Wu (Left Chromium)
2013/04/30 22:42:17
I asked the same question in the pepper host cl, b
dmichael (off chromium)
2013/04/30 23:05:39
Either model is fine w.r.t. how you hook it up to
Ronghua Wu (Left Chromium)
2013/05/01 04:07:31
Thanks David.
If I understand correctly, for this
|
| + |
| + protected: |
| + virtual ~FrameReaderInterface() {} |
| +}; |
| + |
| +// PpFrameReader implements cricket::VideoRenderer so that it can be attached |
| +// to native video track's video source. It also implements |
| +// FrameReaderInterface, which will be used by the effects pepper plugin to |
| +// get the captured frame. |
| +class CONTENT_EXPORT PpFrameReader |
| + : public NON_EXPORTED_BASE(cricket::VideoRenderer), |
| + public FrameReaderInterface { |
| + public: |
| + PpFrameReader(); |
| + virtual ~PpFrameReader(); |
| + |
| + // Implements VideoRenderer. |
| + virtual bool SetSize(int width, int height, int reserved) OVERRIDE; |
| + virtual bool RenderFrame(const cricket::VideoFrame* frame) OVERRIDE; |
| + |
| + // Implements FrameReaderInterface. |
| + virtual bool GetFrame(cricket::VideoFrame** frame) OVERRIDE; |
| + |
| + private: |
| + scoped_ptr<cricket::VideoFrame> last_frame_; |
| + base::Lock lock_; |
| +}; |
| + |
| +// VideoSourceHandler is a glue class between the webrtc MediaStream and |
| +// the effects pepper plugin host. |
| +class CONTENT_EXPORT VideoSourceHandler { |
| + public: |
| + VideoSourceHandler(MediaStreamDependencyFactory* factory, |
| + MediaStreamRegistryInterface* registry); |
| + bool Open(const std::string& url, FrameReaderInterface** frame_reader); |
| + bool Close(const std::string& url, FrameReaderInterface* frame_reader); |
|
wjia(left Chromium)
2013/04/30 18:32:11
Please add detailed comments for public API functi
Ronghua Wu (Left Chromium)
2013/04/30 22:42:17
Done.
|
| + |
| + private: |
| + scoped_refptr<webrtc::VideoSourceInterface> GetFirstVideoSource( |
| + const std::string& url); |
| + |
| + MediaStreamDependencyFactory* factory_; |
| + MediaStreamRegistryInterface* registry_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ |
| + |
| Property changes on: content/renderer/media/video_source_handler.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |