OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // AudioInputDeviceManager manages the audio input devices. In particular it | 5 // AudioInputDeviceManager manages the audio input devices. In particular it |
6 // communicates with MediaStreamManager and AudioInputRendererHost on the | 6 // communicates with MediaStreamManager and AudioInputRendererHost on the |
7 // browser IO thread, handles queries like enumerate/open/close from | 7 // browser IO thread, handles queries like enumerate/open/close from |
8 // MediaStreamManager and start/stop from AudioInputRendererHost. | 8 // MediaStreamManager and start/stop from AudioInputRendererHost. |
9 | 9 |
10 // All the queries come from the IO thread, while the work to enumerate devices | 10 // All the queries come from the IO thread, while the work to enumerate devices |
(...skipping 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 class AudioInputDeviceManagerEventHandler; | 26 class AudioInputDeviceManagerEventHandler; |
27 | 27 |
28 class CONTENT_EXPORT AudioInputDeviceManager : public MediaStreamProvider { | 28 class CONTENT_EXPORT AudioInputDeviceManager : public MediaStreamProvider { |
29 public: | 29 public: |
30 // Calling Start() with this kFakeOpenSessionId will open the default device, | 30 // Calling Start() with this kFakeOpenSessionId will open the default device, |
31 // even though Open() has not been called. This is used to be able to use the | 31 // even though Open() has not been called. This is used to be able to use the |
32 // AudioInputDeviceManager before MediaStream is implemented. | 32 // AudioInputDeviceManager before MediaStream is implemented. |
33 static const int kFakeOpenSessionId; | 33 static const int kFakeOpenSessionId; |
34 static const int kInvalidSessionId; | 34 static const int kInvalidSessionId; |
35 static const int kInvalidDevice; | 35 static const char kInvalidDeviceUId[]; |
tommi (sloooow) - chröme
2011/11/15 10:29:07
kInvalidDeviceUniqueID or perhaps just kInvalidDev
no longer working on chromium
2011/11/16 17:47:21
Done.
| |
36 static const int kDefaultDeviceIndex; | |
37 | 36 |
38 AudioInputDeviceManager(); | 37 AudioInputDeviceManager(); |
39 virtual ~AudioInputDeviceManager(); | 38 virtual ~AudioInputDeviceManager(); |
40 | 39 |
41 // MediaStreamProvider implementation, called on IO thread. | 40 // MediaStreamProvider implementation, called on IO thread. |
42 virtual void Register(MediaStreamProviderListener* listener); | 41 virtual void Register(MediaStreamProviderListener* listener); |
43 virtual void Unregister(); | 42 virtual void Unregister(); |
44 virtual void EnumerateDevices(); | 43 virtual void EnumerateDevices(); |
45 virtual int Open(const StreamDeviceInfo& device); | 44 virtual int Open(const StreamDeviceInfo& device); |
46 virtual void Close(int session_id); | 45 virtual void Close(int session_id); |
(...skipping 16 matching lines...) Expand all Loading... | |
63 void StartOnDeviceThread(int session_id); | 62 void StartOnDeviceThread(int session_id); |
64 void StopOnDeviceThread(int session_id); | 63 void StopOnDeviceThread(int session_id); |
65 | 64 |
66 // Executed on IO thread to call Listener. | 65 // Executed on IO thread to call Listener. |
67 void DevicesEnumeratedOnIOThread(const StreamDeviceInfoArray& devices); | 66 void DevicesEnumeratedOnIOThread(const StreamDeviceInfoArray& devices); |
68 void OpenedOnIOThread(int session_id); | 67 void OpenedOnIOThread(int session_id); |
69 void ClosedOnIOThread(int session_id); | 68 void ClosedOnIOThread(int session_id); |
70 void ErrorOnIOThread(int session_id, MediaStreamProviderError error); | 69 void ErrorOnIOThread(int session_id, MediaStreamProviderError error); |
71 | 70 |
72 // Executed on IO thread to call the event handler. | 71 // Executed on IO thread to call the event handler. |
73 void StartedOnIOThread(int session_id, int index); | 72 void StartedOnIOThread(int session_id, const std::string& device_uid); |
74 void StoppedOnIOThread(int session_id); | 73 void StoppedOnIOThread(int session_id); |
75 | 74 |
76 // Executed on audio_input_device_thread_ to make sure | 75 // Executed on audio_input_device_thread_ to make sure |
77 // MediaStreamProviderListener is called from IO thread. | 76 // MediaStreamProviderListener is called from IO thread. |
78 void SignalError(int session_id, MediaStreamProviderError error); | 77 void SignalError(int session_id, MediaStreamProviderError error); |
79 | 78 |
80 // Helpers. | 79 // Helpers. |
81 bool IsOnCaptureDeviceThread() const; | 80 bool IsOnCaptureDeviceThread() const; |
82 void UnregisterEventHandler(int session_id); | 81 void UnregisterEventHandler(int session_id); |
83 bool HasEventHandler(int session_id); | 82 bool HasEventHandler(int session_id); |
(...skipping 12 matching lines...) Expand all Loading... | |
96 AudioInputDeviceMap devices_; | 95 AudioInputDeviceMap devices_; |
97 | 96 |
98 DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManager); | 97 DISALLOW_COPY_AND_ASSIGN(AudioInputDeviceManager); |
99 }; | 98 }; |
100 | 99 |
101 } // namespace media_stream | 100 } // namespace media_stream |
102 | 101 |
103 DISABLE_RUNNABLE_METHOD_REFCOUNT(media_stream::AudioInputDeviceManager); | 102 DISABLE_RUNNABLE_METHOD_REFCOUNT(media_stream::AudioInputDeviceManager); |
104 | 103 |
105 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_ | 104 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_DEVICE_MANAGER_H_ |
OLD | NEW |