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

Side by Side Diff: content/renderer/media/video_source_handler.h

Issue 14312015: Effects Pepper Plugin and MediaStream Glue. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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 <map>
9 #include <string>
10
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "content/common/content_export.h"
14 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h"
15
16 namespace cricket {
17 class VideoFrame;
18 }
19
20 namespace content {
21
22 class MediaStreamDependencyFactory;
23 class MediaStreamRegistryInterface;
24
25 // Interface used by the effects pepper plugin to get captured frame
26 // from the video track.
27 class CONTENT_EXPORT FrameReaderInterface {
28 public:
29 // Got a new captured frame.
30 // The ownership of the |frame| transfers to the caller. So the caller must
wjia(left Chromium) 2013/05/03 21:42:55 nit: is transferred to.
Ronghua Wu (Left Chromium) 2013/05/03 22:40:02 Done.
31 // delete |frame| when done with it.
32 virtual bool GotFrame(cricket::VideoFrame* frame) = 0;
33
34 protected:
35 virtual ~FrameReaderInterface() {}
36 };
37
38 // VideoSourceHandler is a glue class between the webrtc MediaStream and
39 // the effects pepper plugin host.
40 class CONTENT_EXPORT VideoSourceHandler {
41 public:
42 VideoSourceHandler(MediaStreamDependencyFactory* factory,
43 MediaStreamRegistryInterface* registry);
44 virtual ~VideoSourceHandler();
45 // Connects to the first video track in the MediaStream specified by |url| and
46 // the received frames will be delivered via |reader|.
47 // Returns true on success and false on failure.
48 bool Open(const std::string& url, FrameReaderInterface* reader);
49 // Closes |reader|'s connection with the first video track in
50 // the MediaStream specified by |url|, i.e. stops receiving frames from the
51 // video track.
52 // Returns true on success and false on failure.
53 bool Close(const std::string& url, FrameReaderInterface* reader);
54
55 // Gets the VideoRenderer associated with |reader|.
56 // Made it public only for testing purpose.
57 cricket::VideoRenderer* GetReceiver(FrameReaderInterface* reader);
58
59 private:
60 scoped_refptr<webrtc::VideoSourceInterface> GetFirstVideoSource(
61 const std::string& url);
62
63 MediaStreamDependencyFactory* factory_;
64 MediaStreamRegistryInterface* registry_;
65 std::map<FrameReaderInterface*, cricket::VideoRenderer*> reader_to_receiver_;
66
67 DISALLOW_COPY_AND_ASSIGN(VideoSourceHandler);
68 };
69
70 } // namespace content
71
72 #endif // CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_
73
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698