Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ | |
| 6 #define CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/compiler_specific.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/synchronization/lock.h" | |
| 14 #include "content/common/content_export.h" | |
| 15 #include "content/renderer/media/media_stream_registry_interface.h" | |
| 16 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" | |
| 17 #include "third_party/libjingle/source/talk/media/base/videoframe.h" | |
| 18 #include "third_party/libjingle/source/talk/media/base/videorenderer.h" | |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" | |
| 20 | |
| 21 namespace content { | |
| 22 | |
| 23 class MediaStreamDependencyFactory; | |
| 24 class MediaStreamRegistryInterface; | |
| 25 | |
| 26 // Interface used by the effects pepper plugin to get captured frame | |
| 27 // from the video track. | |
| 28 class CONTENT_EXPORT FrameReaderInterface { | |
| 29 public: | |
| 30 // The ownership of the |frame| transfers to the caller. So the caller must | |
| 31 // release |frame| when done with it. | |
| 32 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
| |
| 33 | |
| 34 protected: | |
| 35 virtual ~FrameReaderInterface() {} | |
| 36 }; | |
| 37 | |
| 38 // PpFrameReader implements cricket::VideoRenderer so that it can be attached | |
| 39 // to native video track's video source. It also implements | |
| 40 // FrameReaderInterface, which will be used by the effects pepper plugin to | |
| 41 // get the captured frame. | |
| 42 class CONTENT_EXPORT PpFrameReader | |
| 43 : public NON_EXPORTED_BASE(cricket::VideoRenderer), | |
| 44 public FrameReaderInterface { | |
| 45 public: | |
| 46 PpFrameReader(); | |
| 47 virtual ~PpFrameReader(); | |
| 48 | |
| 49 // Implements VideoRenderer. | |
| 50 virtual bool SetSize(int width, int height, int reserved) OVERRIDE; | |
| 51 virtual bool RenderFrame(const cricket::VideoFrame* frame) OVERRIDE; | |
| 52 | |
| 53 // Implements FrameReaderInterface. | |
| 54 virtual bool GetFrame(cricket::VideoFrame** frame) OVERRIDE; | |
| 55 | |
| 56 private: | |
| 57 scoped_ptr<cricket::VideoFrame> last_frame_; | |
| 58 base::Lock lock_; | |
| 59 }; | |
| 60 | |
| 61 // VideoSourceHandler is a glue class between the webrtc MediaStream and | |
| 62 // the effects pepper plugin host. | |
| 63 class CONTENT_EXPORT VideoSourceHandler { | |
| 64 public: | |
| 65 VideoSourceHandler(MediaStreamDependencyFactory* factory, | |
| 66 MediaStreamRegistryInterface* registry); | |
| 67 bool Open(const std::string& url, FrameReaderInterface** frame_reader); | |
| 68 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.
| |
| 69 | |
| 70 private: | |
| 71 scoped_refptr<webrtc::VideoSourceInterface> GetFirstVideoSource( | |
| 72 const std::string& url); | |
| 73 | |
| 74 MediaStreamDependencyFactory* factory_; | |
| 75 MediaStreamRegistryInterface* registry_; | |
| 76 }; | |
| 77 | |
| 78 } // namespace content | |
| 79 | |
| 80 #endif // CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ | |
| 81 | |
| OLD | NEW |