OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const service_manager::BindSourceInfo& source_info, | 44 const service_manager::BindSourceInfo& source_info, |
45 ::mojom::MediaDevicesDispatcherHostRequest request); | 45 ::mojom::MediaDevicesDispatcherHostRequest request); |
46 | 46 |
47 // ::mojom::MediaDevicesDispatcherHost implementation. | 47 // ::mojom::MediaDevicesDispatcherHost implementation. |
48 void EnumerateDevices(bool request_audio_input, | 48 void EnumerateDevices(bool request_audio_input, |
49 bool request_video_input, | 49 bool request_video_input, |
50 bool request_audio_output, | 50 bool request_audio_output, |
51 EnumerateDevicesCallback client_callback) override; | 51 EnumerateDevicesCallback client_callback) override; |
52 void GetVideoInputCapabilities( | 52 void GetVideoInputCapabilities( |
53 GetVideoInputCapabilitiesCallback client_callback) override; | 53 GetVideoInputCapabilitiesCallback client_callback) override; |
| 54 void GetAudioInputCapabilities( |
| 55 GetAudioInputCapabilitiesCallback client_callback) override; |
54 void SubscribeDeviceChangeNotifications(MediaDeviceType type, | 56 void SubscribeDeviceChangeNotifications(MediaDeviceType type, |
55 uint32_t subscription_id) override; | 57 uint32_t subscription_id) override; |
56 void UnsubscribeDeviceChangeNotifications(MediaDeviceType type, | 58 void UnsubscribeDeviceChangeNotifications(MediaDeviceType type, |
57 uint32_t subscription_id) override; | 59 uint32_t subscription_id) override; |
58 | 60 |
59 // MediaDeviceChangeSubscriber implementation. | 61 // MediaDeviceChangeSubscriber implementation. |
60 void OnDevicesChanged(MediaDeviceType type, | 62 void OnDevicesChanged(MediaDeviceType type, |
61 const MediaDeviceInfoArray& device_infos) override; | 63 const MediaDeviceInfoArray& device_infos) override; |
62 | 64 |
63 void SetPermissionChecker( | 65 void SetPermissionChecker( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 GetVideoInputCapabilitiesCallback client_callback, | 97 GetVideoInputCapabilitiesCallback client_callback, |
96 const url::Origin& security_origin, | 98 const url::Origin& security_origin, |
97 const std::string& default_device_id); | 99 const std::string& default_device_id); |
98 | 100 |
99 void FinalizeGetVideoInputCapabilities( | 101 void FinalizeGetVideoInputCapabilities( |
100 GetVideoInputCapabilitiesCallback client_callback, | 102 GetVideoInputCapabilitiesCallback client_callback, |
101 const url::Origin& security_origin, | 103 const url::Origin& security_origin, |
102 const std::string& default_device_id, | 104 const std::string& default_device_id, |
103 const media::VideoCaptureDeviceDescriptors& device_descriptors); | 105 const media::VideoCaptureDeviceDescriptors& device_descriptors); |
104 | 106 |
| 107 void GetDefaultAudioInputDeviceID( |
| 108 GetAudioInputCapabilitiesCallback client_callback, |
| 109 const url::Origin& security_origin); |
| 110 |
| 111 void GotDefaultAudioInputDeviceID(const std::string& default_device_id); |
| 112 |
| 113 void GotAudioInputEnumeration(const std::string& default_device_id, |
| 114 const MediaDeviceEnumeration& enumeration); |
| 115 |
| 116 void GotAudioInputParameters(size_t index, |
| 117 const media::AudioParameters& parameters); |
| 118 |
| 119 void FinalizeGetAudioInputCapabilities(); |
| 120 |
105 // Returns the currently supported video formats for the given |device_id|. | 121 // Returns the currently supported video formats for the given |device_id|. |
106 media::VideoCaptureFormats GetVideoInputFormats(const std::string& device_id); | 122 media::VideoCaptureFormats GetVideoInputFormats(const std::string& device_id); |
107 | 123 |
108 void NotifyDeviceChangeOnUIThread(const std::vector<uint32_t>& subscriptions, | 124 void NotifyDeviceChangeOnUIThread(const std::vector<uint32_t>& subscriptions, |
109 MediaDeviceType type, | 125 MediaDeviceType type, |
110 const MediaDeviceInfoArray& device_infos); | 126 const MediaDeviceInfoArray& device_infos); |
111 | 127 |
112 // The following const fields can be accessed on any thread. | 128 // The following const fields can be accessed on any thread. |
113 const int render_process_id_; | 129 const int render_process_id_; |
114 const int render_frame_id_; | 130 const int render_frame_id_; |
115 const std::string device_id_salt_; | 131 const std::string device_id_salt_; |
116 const std::string group_id_salt_; | 132 const std::string group_id_salt_; |
117 | 133 |
118 // The following fields can only be accessed on the IO thread. | 134 // The following fields can only be accessed on the IO thread. |
119 MediaStreamManager* media_stream_manager_; | 135 MediaStreamManager* media_stream_manager_; |
120 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_; | 136 std::unique_ptr<MediaDevicesPermissionChecker> permission_checker_; |
121 std::vector<uint32_t> device_change_subscriptions_[NUM_MEDIA_DEVICE_TYPES]; | 137 std::vector<uint32_t> device_change_subscriptions_[NUM_MEDIA_DEVICE_TYPES]; |
122 | 138 |
123 // This field can only be accessed on the UI thread. | 139 // This field can only be accessed on the UI thread. |
124 ::mojom::MediaDevicesListenerPtr device_change_listener_; | 140 ::mojom::MediaDevicesListenerPtr device_change_listener_; |
125 url::Origin security_origin_for_testing_; | 141 url::Origin security_origin_for_testing_; |
126 | 142 |
| 143 struct AudioInputCapabilitiesRequest; |
| 144 // Queued requests for audio-input capabilities. |
| 145 std::vector<AudioInputCapabilitiesRequest> |
| 146 pending_audio_input_capabilities_requests_; |
| 147 size_t num_pending_audio_input_parameters_; |
| 148 std::vector<::mojom::AudioInputDeviceCapabilities> |
| 149 current_audio_input_capabilities_; |
| 150 |
127 base::WeakPtrFactory<MediaDevicesDispatcherHost> weak_factory_; | 151 base::WeakPtrFactory<MediaDevicesDispatcherHost> weak_factory_; |
128 | 152 |
129 DISALLOW_COPY_AND_ASSIGN(MediaDevicesDispatcherHost); | 153 DISALLOW_COPY_AND_ASSIGN(MediaDevicesDispatcherHost); |
130 }; | 154 }; |
131 | 155 |
132 } // namespace content | 156 } // namespace content |
133 | 157 |
134 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ | 158 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_DEVICES_DISPATCHER_HOST_H_ |
OLD | NEW |