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 #ifndef CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 19 matching lines...) Expand all Loading... | |
30 #include "third_party/WebKit/public/web/WebMediaDeviceChangeObserver.h" | 30 #include "third_party/WebKit/public/web/WebMediaDeviceChangeObserver.h" |
31 #include "third_party/WebKit/public/web/WebMediaDevicesRequest.h" | 31 #include "third_party/WebKit/public/web/WebMediaDevicesRequest.h" |
32 #include "third_party/WebKit/public/web/WebUserMediaClient.h" | 32 #include "third_party/WebKit/public/web/WebUserMediaClient.h" |
33 #include "third_party/WebKit/public/web/WebUserMediaRequest.h" | 33 #include "third_party/WebKit/public/web/WebUserMediaRequest.h" |
34 | 34 |
35 namespace base { | 35 namespace base { |
36 class TaskRunner; | 36 class TaskRunner; |
37 } | 37 } |
38 | 38 |
39 namespace content { | 39 namespace content { |
40 class PeerConnectionDependencyFactory; | 40 class AudioCaptureSettings; |
41 class MediaStreamAudioSource; | 41 class MediaStreamAudioSource; |
42 class MediaStreamDispatcher; | 42 class MediaStreamDispatcher; |
43 class MediaStreamVideoSource; | 43 class MediaStreamVideoSource; |
44 class PeerConnectionDependencyFactory; | |
44 class VideoCaptureSettings; | 45 class VideoCaptureSettings; |
45 | 46 |
46 // UserMediaClientImpl is a delegate for the Media Stream GetUserMedia API. | 47 // UserMediaClientImpl is a delegate for the Media Stream GetUserMedia API. |
47 // It ties together WebKit and MediaStreamManager | 48 // It ties together WebKit and MediaStreamManager |
48 // (via MediaStreamDispatcher and MediaStreamDispatcherHost) | 49 // (via MediaStreamDispatcher and MediaStreamDispatcherHost) |
49 // in the browser process. It must be created, called and destroyed on the | 50 // in the browser process. It must be created, called and destroyed on the |
50 // render thread. | 51 // render thread. |
51 class CONTENT_EXPORT UserMediaClientImpl | 52 class CONTENT_EXPORT UserMediaClientImpl |
52 : public RenderFrameObserver, | 53 : public RenderFrameObserver, |
53 NON_EXPORTED_BASE(public blink::WebUserMediaClient), | 54 NON_EXPORTED_BASE(public blink::WebUserMediaClient), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 virtual MediaStreamAudioSource* CreateAudioSource( | 115 virtual MediaStreamAudioSource* CreateAudioSource( |
115 const StreamDeviceInfo& device, | 116 const StreamDeviceInfo& device, |
116 const blink::WebMediaConstraints& constraints, | 117 const blink::WebMediaConstraints& constraints, |
117 const MediaStreamSource::ConstraintsCallback& source_ready); | 118 const MediaStreamSource::ConstraintsCallback& source_ready); |
118 virtual MediaStreamVideoSource* CreateVideoSource( | 119 virtual MediaStreamVideoSource* CreateVideoSource( |
119 const StreamDeviceInfo& device, | 120 const StreamDeviceInfo& device, |
120 const MediaStreamSource::SourceStoppedCallback& stop_callback); | 121 const MediaStreamSource::SourceStoppedCallback& stop_callback); |
121 | 122 |
122 // Returns no value if there is no request being processed. Use only for | 123 // Returns no value if there is no request being processed. Use only for |
123 // testing. | 124 // testing. |
124 // TODO(guidou): Remove this method once spec-compliant constraints algorithm | 125 // TODO(guidou): Remove this function. http://crbug.com/706408 |
125 // for audio is implemented. http://crbug.com/543997 | |
126 base::Optional<bool> AutomaticOutputDeviceSelectionEnabledForCurrentRequest(); | 126 base::Optional<bool> AutomaticOutputDeviceSelectionEnabledForCurrentRequest(); |
127 | 127 |
128 // Intended to be used only for testing. | |
129 const AudioCaptureSettings& AudioCaptureSettingsForCurrentRequest() const; | |
miu
2017/06/19 21:18:44
Couple suggestions:
1. naming/style: Test-only me
Guido Urdaneta
2017/06/20 12:18:48
Did not expose |current_request_info_| because its
| |
130 const VideoCaptureSettings& VideoCaptureSettingsForCurrentRequest() const; | |
131 | |
128 private: | 132 private: |
129 class UserMediaRequestInfo; | 133 class UserMediaRequestInfo; |
130 typedef std::vector<blink::WebMediaStreamSource> LocalStreamSources; | 134 typedef std::vector<blink::WebMediaStreamSource> LocalStreamSources; |
131 | 135 |
132 void MaybeProcessNextRequestInfo(); | 136 void MaybeProcessNextRequestInfo(); |
133 bool IsCurrentRequestInfo(int request_id) const; | 137 bool IsCurrentRequestInfo(int request_id) const; |
134 bool IsCurrentRequestInfo(const blink::WebUserMediaRequest& request) const; | 138 bool IsCurrentRequestInfo(const blink::WebUserMediaRequest& request) const; |
135 bool DeleteRequestInfo(const blink::WebUserMediaRequest& request); | 139 bool DeleteRequestInfo(const blink::WebUserMediaRequest& request); |
136 void DelayedGetUserMediaRequestSucceeded(const blink::WebMediaStream& stream, | 140 void DelayedGetUserMediaRequestSucceeded(const blink::WebMediaStream& stream, |
137 blink::WebUserMediaRequest request); | 141 blink::WebUserMediaRequest request); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 | 222 |
219 // Returns true if we do find and remove the |source|. | 223 // Returns true if we do find and remove the |source|. |
220 // Otherwise returns false. | 224 // Otherwise returns false. |
221 bool RemoveLocalSource(const blink::WebMediaStreamSource& source); | 225 bool RemoveLocalSource(const blink::WebMediaStreamSource& source); |
222 | 226 |
223 void StopLocalSource(const blink::WebMediaStreamSource& source, | 227 void StopLocalSource(const blink::WebMediaStreamSource& source, |
224 bool notify_dispatcher); | 228 bool notify_dispatcher); |
225 | 229 |
226 const ::mojom::MediaDevicesDispatcherHostPtr& GetMediaDevicesDispatcher(); | 230 const ::mojom::MediaDevicesDispatcherHostPtr& GetMediaDevicesDispatcher(); |
227 | 231 |
228 void SelectAudioInputDevice( | 232 // TODO(guidou): Remove these functions. http://crbug.com/706408 |
233 void LegacySetupAudioInput(); | |
234 void LegacySelectAudioInputDevice( | |
229 const blink::WebUserMediaRequest& user_media_request, | 235 const blink::WebUserMediaRequest& user_media_request, |
230 const EnumerationResult& device_enumeration); | 236 const EnumerationResult& device_enumeration); |
231 | 237 |
238 void SetupAudioInput(const blink::WebUserMediaRequest& user_media_request); | |
239 void SelectAudioSettings(const blink::WebUserMediaRequest& user_media_request, | |
240 std::vector<::mojom::AudioInputDeviceCapabilitiesPtr> | |
241 audio_input_capabilities); | |
242 | |
232 void SetupVideoInput(const blink::WebUserMediaRequest& user_media_request); | 243 void SetupVideoInput(const blink::WebUserMediaRequest& user_media_request); |
233 | |
234 void SelectVideoDeviceSettings( | 244 void SelectVideoDeviceSettings( |
235 const blink::WebUserMediaRequest& user_media_request, | 245 const blink::WebUserMediaRequest& user_media_request, |
236 std::vector<::mojom::VideoInputDeviceCapabilitiesPtr> | 246 std::vector<::mojom::VideoInputDeviceCapabilitiesPtr> |
237 video_input_capabilities); | 247 video_input_capabilities); |
238 | |
239 void FinalizeSelectVideoDeviceSettings( | 248 void FinalizeSelectVideoDeviceSettings( |
240 const blink::WebUserMediaRequest& user_media_request, | 249 const blink::WebUserMediaRequest& user_media_request, |
241 const VideoCaptureSettings& settings); | 250 const VideoCaptureSettings& settings); |
242 | |
243 void FinalizeSelectVideoContentSettings( | 251 void FinalizeSelectVideoContentSettings( |
244 const blink::WebUserMediaRequest& user_media_request, | 252 const blink::WebUserMediaRequest& user_media_request, |
245 const VideoCaptureSettings& settings); | 253 const VideoCaptureSettings& settings); |
246 | 254 |
247 void GenerateStreamForCurrentRequestInfo(); | 255 void GenerateStreamForCurrentRequestInfo(); |
248 | 256 |
249 // Callback invoked by MediaDevicesEventDispatcher when a device-change | 257 // Callback invoked by MediaDevicesEventDispatcher when a device-change |
250 // notification arrives. | 258 // notification arrives. |
251 void DevicesChanged(MediaDeviceType device_type, | 259 void DevicesChanged(MediaDeviceType device_type, |
252 const MediaDeviceInfoArray& device_infos); | 260 const MediaDeviceInfoArray& device_infos); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 // Note: This member must be the last to ensure all outstanding weak pointers | 292 // Note: This member must be the last to ensure all outstanding weak pointers |
285 // are invalidated first. | 293 // are invalidated first. |
286 base::WeakPtrFactory<UserMediaClientImpl> weak_factory_; | 294 base::WeakPtrFactory<UserMediaClientImpl> weak_factory_; |
287 | 295 |
288 DISALLOW_COPY_AND_ASSIGN(UserMediaClientImpl); | 296 DISALLOW_COPY_AND_ASSIGN(UserMediaClientImpl); |
289 }; | 297 }; |
290 | 298 |
291 } // namespace content | 299 } // namespace content |
292 | 300 |
293 #endif // CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ | 301 #endif // CONTENT_RENDERER_MEDIA_USER_MEDIA_CLIENT_IMPL_H_ |
OLD | NEW |