OLD | NEW |
---|---|
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 // MediaStreamProvider is used to capture media of the types defined in | 5 // MediaStreamProvider is used to capture media of the types defined in |
6 // MediaStreamType. There is only one MediaStreamProvider instance per media | 6 // MediaStreamType. There is only one MediaStreamProvider instance per media |
7 // type and a MediaStreamProvider instance can have only one registered | 7 // type and a MediaStreamProvider instance can have only one registered |
8 // listener. | 8 // listener. |
9 // The MediaStreamManager is expected to be called on Browser::IO thread and | 9 // The MediaStreamManager is expected to be called on Browser::IO thread and |
10 // the listener will be called on the same thread. | 10 // the listener will be called on the same thread. |
11 | 11 |
12 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ | 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ |
13 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ | 13 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ |
14 | 14 |
15 #include <list> | 15 #include <list> |
16 #include <string> | 16 #include <string> |
17 | 17 |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
20 #include "content/common/media/media_stream_options.h" | 20 #include "content/common/media/media_stream_options.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class MessageLoopProxy; | 23 class SingleThreadTaskRunner; |
24 } | 24 } |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
28 enum MediaStreamProviderError { | 28 enum MediaStreamProviderError { |
29 kMediaStreamOk = 0, | 29 kMediaStreamOk = 0, |
30 kInvalidMediaStreamType, | 30 kInvalidMediaStreamType, |
31 kInvalidSession, | 31 kInvalidSession, |
32 kUnknownSession, | 32 kUnknownSession, |
33 kDeviceNotAvailable, | 33 kDeviceNotAvailable, |
(...skipping 14 matching lines...) Expand all Loading... | |
48 | 48 |
49 // Called by a MediaStreamProvider when available devices has been enumerated. | 49 // Called by a MediaStreamProvider when available devices has been enumerated. |
50 virtual void DevicesEnumerated(MediaStreamType stream_type, | 50 virtual void DevicesEnumerated(MediaStreamType stream_type, |
51 const StreamDeviceInfoArray& devices) = 0; | 51 const StreamDeviceInfoArray& devices) = 0; |
52 | 52 |
53 protected: | 53 protected: |
54 virtual ~MediaStreamProviderListener() {} | 54 virtual ~MediaStreamProviderListener() {} |
55 }; | 55 }; |
56 | 56 |
57 // Implemented by a manager class providing captured media. | 57 // Implemented by a manager class providing captured media. |
58 class CONTENT_EXPORT MediaStreamProvider | 58 class CONTENT_EXPORT MediaStreamProvider |
DaleCurtis
2014/02/04 19:10:42
Note: It looks like this class only has one implem
tommi (sloooow) - chröme
2014/02/04 20:45:57
Sgtm
DaleCurtis
2014/02/04 20:56:06
Actually I misread this early. Both AudioInputDev
| |
59 : public base::RefCountedThreadSafe<MediaStreamProvider> { | 59 : public base::RefCountedThreadSafe<MediaStreamProvider> { |
60 public: | 60 public: |
61 // Registers a listener and a device message loop. | 61 // Registers a listener and a device message loop. |
62 virtual void Register(MediaStreamProviderListener* listener, | 62 virtual void Register(MediaStreamProviderListener* listener, |
63 base::MessageLoopProxy* device_thread_loop) = 0; | 63 const scoped_refptr<base::SingleThreadTaskRunner>& |
64 device_task_runner) = 0; | |
64 | 65 |
65 // Unregisters the previously registered listener. | 66 // Unregisters the previously registered listener. |
66 virtual void Unregister() = 0; | 67 virtual void Unregister() = 0; |
67 | 68 |
68 // Enumerates existing capture devices and calls |DevicesEnumerated|. | 69 // Enumerates existing capture devices and calls |DevicesEnumerated|. |
69 virtual void EnumerateDevices(MediaStreamType stream_type) = 0; | 70 virtual void EnumerateDevices(MediaStreamType stream_type) = 0; |
70 | 71 |
71 // Opens the specified device. The device is not started and it is still | 72 // Opens the specified device. The device is not started and it is still |
72 // possible for other applications to open the device before the device is | 73 // possible for other applications to open the device before the device is |
73 // started. |Opened| is called when the device is opened. | 74 // started. |Opened| is called when the device is opened. |
74 // kInvalidMediaCaptureSessionId is returned on error. | 75 // kInvalidMediaCaptureSessionId is returned on error. |
75 virtual int Open(const StreamDeviceInfo& device) = 0; | 76 virtual int Open(const StreamDeviceInfo& device) = 0; |
76 | 77 |
77 // Closes the specified device and calls |Closed| when done. | 78 // Closes the specified device and calls |Closed| when done. |
78 virtual void Close(int capture_session_id) = 0; | 79 virtual void Close(int capture_session_id) = 0; |
79 | 80 |
80 protected: | 81 protected: |
81 friend class base::RefCountedThreadSafe<MediaStreamProvider>; | 82 friend class base::RefCountedThreadSafe<MediaStreamProvider>; |
82 virtual ~MediaStreamProvider() {} | 83 virtual ~MediaStreamProvider() {} |
83 }; | 84 }; |
84 | 85 |
85 } // namespace content | 86 } // namespace content |
86 | 87 |
87 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ | 88 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ |
OLD | NEW |