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

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

Issue 16320005: Define EncodedVideoSource and RtcCapturedEncodingVideoCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // VideoCaptureImplManager manages video capture devices in renderer process. 5 // VideoCaptureImplManager manages video capture devices in renderer process.
6 // The video capture clients use AddDevice() to get a pointer to 6 // The video capture clients use AddDevice() to get a pointer to
7 // video capture device. VideoCaputreImplManager supports multiple clients 7 // video capture device. VideoCaputreImplManager supports multiple clients
8 // accessing same device. 8 // accessing same device.
9 9
10 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 10 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
11 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 11 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
12 12
13 #include <list> 13 #include <list>
14 #include <map> 14 #include <map>
15 15
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "base/message_loop_proxy.h" 17 #include "base/message_loop_proxy.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "media/video/capture/video_capture.h" 20 #include "media/video/capture/video_capture.h"
21 #include "media/video/encoded_video_source.h"
21 22
22 namespace content { 23 namespace content {
23 24
25 class RtcEncodingVideoCapturerFactory;
24 class VideoCaptureImpl; 26 class VideoCaptureImpl;
25 class VideoCaptureMessageFilter; 27 class VideoCaptureMessageFilter;
26 28
27 class CONTENT_EXPORT VideoCaptureImplManager 29 class CONTENT_EXPORT VideoCaptureImplManager
28 : public base::RefCountedThreadSafe<VideoCaptureImplManager> { 30 : public base::RefCountedThreadSafe<VideoCaptureImplManager> {
29 public: 31 public:
30 VideoCaptureImplManager(); 32 VideoCaptureImplManager();
31 33
32 // Called by video capture client |handler| to add device referenced 34 // Called by video capture client |handler| to add device referenced
33 // by |id| to VideoCaptureImplManager's list of opened device list. 35 // by |id| to VideoCaptureImplManager's list of opened device list.
34 // A pointer to VideoCapture is returned to client so that client can 36 // A pointer to VideoCapture is returned to client so that client can
35 // operate on that pointer, such as StartCaptrue, StopCapture. 37 // operate on that pointer, such as StartCaptrue, StopCapture.
36 virtual media::VideoCapture* AddDevice( 38 virtual media::VideoCapture* AddDevice(
37 media::VideoCaptureSessionId id, 39 media::VideoCaptureSessionId id,
38 media::VideoCapture::EventHandler* handler); 40 media::VideoCapture::EventHandler* handler);
39 41
40 // Called by video capture client |handler| to remove device referenced 42 // Called by video capture client |handler| to remove device referenced
41 // by |id| from VideoCaptureImplManager's list of opened device list. 43 // by |id| from VideoCaptureImplManager's list of opened device list.
42 virtual void RemoveDevice(media::VideoCaptureSessionId id, 44 virtual void RemoveDevice(media::VideoCaptureSessionId id,
43 media::VideoCapture::EventHandler* handler); 45 media::VideoCapture::EventHandler* handler);
44 46
45 // Make all existing VideoCaptureImpl instances stop/resume delivering 47 // Make all existing VideoCaptureImpl instances stop/resume delivering
46 // video frames to their clients, depends on flag |suspend|. 48 // video frames to their clients, depends on flag |suspend|.
47 virtual void SuspendDevices(bool suspend); 49 virtual void SuspendDevices(bool suspend);
48 50
49 VideoCaptureMessageFilter* video_capture_message_filter() const { 51 VideoCaptureMessageFilter* video_capture_message_filter() const {
50 return filter_.get(); 52 return filter_.get();
51 } 53 }
52 54
55 RtcEncodingVideoCapturerFactory* encoding_capturer_factory() const {
Ami GONE FROM CHROMIUM 2013/06/08 00:18:01 It's almost never a good idea to return a raw poin
hshi1 2013/06/12 00:50:24 The problem I'm facing is that the factory pointer
hshi1 2013/06/13 22:03:46 I've made the following change: (1) the encoding_c
56 return encoding_capturer_factory_.get();
57 }
58
53 protected: 59 protected:
54 virtual ~VideoCaptureImplManager(); 60 virtual ~VideoCaptureImplManager();
55 61
56 private: 62 private:
57 friend class base::RefCountedThreadSafe<VideoCaptureImplManager>; 63 friend class base::RefCountedThreadSafe<VideoCaptureImplManager>;
58 64
59 struct Device { 65 struct Device {
60 Device(VideoCaptureImpl* device, 66 Device(VideoCaptureImpl* device,
61 media::VideoCapture::EventHandler* handler); 67 media::VideoCapture::EventHandler* handler);
62 ~Device(); 68 ~Device();
63 69
64 VideoCaptureImpl* vc; 70 VideoCaptureImpl* vc;
65 std::list<media::VideoCapture::EventHandler*> clients; 71 std::list<media::VideoCapture::EventHandler*> clients;
66 }; 72 };
67 73
68 void FreeDevice(VideoCaptureImpl* vc); 74 void FreeDevice(VideoCaptureImpl* vc);
69 75
70 typedef std::map<media::VideoCaptureSessionId, Device*> Devices; 76 typedef std::map<media::VideoCaptureSessionId, Device*> Devices;
71 Devices devices_; 77 Devices devices_;
72 base::Lock lock_; 78 base::Lock lock_;
73 scoped_refptr<VideoCaptureMessageFilter> filter_; 79 scoped_refptr<VideoCaptureMessageFilter> filter_;
74 base::Thread thread_; 80 base::Thread thread_;
75 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 81 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
76 82
83 scoped_refptr<RtcEncodingVideoCapturerFactory> encoding_capturer_factory_;
84
77 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager); 85 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager);
78 }; 86 };
79 87
80 } // namespace content 88 } // namespace content
81 89
82 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_ 90 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698