| 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 #include "content/renderer/media/user_media_client_impl.h" | 5 #include "content/renderer/media/user_media_client_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "content/renderer/media/media_stream_audio_source.h" | 23 #include "content/renderer/media/media_stream_audio_source.h" |
| 24 #include "content/renderer/media/media_stream_dispatcher.h" | 24 #include "content/renderer/media/media_stream_dispatcher.h" |
| 25 #include "content/renderer/media/media_stream_video_capturer_source.h" | 25 #include "content/renderer/media/media_stream_video_capturer_source.h" |
| 26 #include "content/renderer/media/media_stream_video_track.h" | 26 #include "content/renderer/media/media_stream_video_track.h" |
| 27 #include "content/renderer/media/peer_connection_tracker.h" | 27 #include "content/renderer/media/peer_connection_tracker.h" |
| 28 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" | 28 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
| 29 #include "content/renderer/media/webrtc_audio_capturer.h" | 29 #include "content/renderer/media/webrtc_audio_capturer.h" |
| 30 #include "content/renderer/media/webrtc_logging.h" | 30 #include "content/renderer/media/webrtc_logging.h" |
| 31 #include "content/renderer/media/webrtc_uma_histograms.h" | 31 #include "content/renderer/media/webrtc_uma_histograms.h" |
| 32 #include "content/renderer/render_thread_impl.h" | 32 #include "content/renderer/render_thread_impl.h" |
| 33 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 33 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 34 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 34 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h" | 35 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h" |
| 35 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 36 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 36 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h
" | 37 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h
" |
| 37 #include "third_party/WebKit/public/web/WebDocument.h" | 38 #include "third_party/WebKit/public/web/WebDocument.h" |
| 38 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 39 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 39 | 40 |
| 40 namespace content { | 41 namespace content { |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 .basic() | 183 .basic() |
| 183 .renderToAssociatedSink.matches(false)) { | 184 .renderToAssociatedSink.matches(false)) { |
| 184 enable_automatic_output_device_selection = true; | 185 enable_automatic_output_device_selection = true; |
| 185 } | 186 } |
| 186 } | 187 } |
| 187 if (user_media_request.video()) { | 188 if (user_media_request.video()) { |
| 188 controls.video.requested = true; | 189 controls.video.requested = true; |
| 189 } | 190 } |
| 190 CopyBlinkRequestToStreamControls(user_media_request, &controls); | 191 CopyBlinkRequestToStreamControls(user_media_request, &controls); |
| 191 | 192 |
| 192 security_origin = GURL(user_media_request.securityOrigin().toString()); | 193 security_origin = |
| 194 blink::WebStringToGURL(user_media_request.securityOrigin().toString()); |
| 193 DCHECK(render_frame()->GetWebFrame() == | 195 DCHECK(render_frame()->GetWebFrame() == |
| 194 static_cast<blink::WebFrame*>( | 196 static_cast<blink::WebFrame*>( |
| 195 user_media_request.ownerDocument().frame())); | 197 user_media_request.ownerDocument().frame())); |
| 196 } | 198 } |
| 197 | 199 |
| 198 DVLOG(1) << "UserMediaClientImpl::requestUserMedia(" << request_id << ", [ " | 200 DVLOG(1) << "UserMediaClientImpl::requestUserMedia(" << request_id << ", [ " |
| 199 << "audio=" << (controls.audio.requested) | 201 << "audio=" << (controls.audio.requested) |
| 200 << " select associated sink: " | 202 << " select associated sink: " |
| 201 << enable_automatic_output_device_selection | 203 << enable_automatic_output_device_selection |
| 202 << ", video=" << (controls.video.requested) << " ], " | 204 << ", video=" << (controls.video.requested) << " ], " |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 DCHECK(CalledOnValidThread()); | 263 DCHECK(CalledOnValidThread()); |
| 262 | 264 |
| 263 int audio_input_request_id = g_next_request_id++; | 265 int audio_input_request_id = g_next_request_id++; |
| 264 int video_input_request_id = g_next_request_id++; | 266 int video_input_request_id = g_next_request_id++; |
| 265 int audio_output_request_id = g_next_request_id++; | 267 int audio_output_request_id = g_next_request_id++; |
| 266 | 268 |
| 267 // |media_devices_request| can't be mocked, so in tests it will be empty (the | 269 // |media_devices_request| can't be mocked, so in tests it will be empty (the |
| 268 // underlying pointer is null). In order to use this function in a test we | 270 // underlying pointer is null). In order to use this function in a test we |
| 269 // need to check if it isNull. | 271 // need to check if it isNull. |
| 270 GURL security_origin; | 272 GURL security_origin; |
| 271 if (!media_devices_request.isNull()) | 273 if (!media_devices_request.isNull()) { |
| 272 security_origin = GURL(media_devices_request.securityOrigin().toString()); | 274 security_origin = blink::WebStringToGURL( |
| 275 media_devices_request.securityOrigin().toString()); |
| 276 } |
| 273 | 277 |
| 274 DVLOG(1) << "UserMediaClientImpl::requestMediaDevices(" | 278 DVLOG(1) << "UserMediaClientImpl::requestMediaDevices(" |
| 275 << audio_input_request_id | 279 << audio_input_request_id |
| 276 << ", " << video_input_request_id << ", " << audio_output_request_id | 280 << ", " << video_input_request_id << ", " << audio_output_request_id |
| 277 << ", " << security_origin.spec() << ")"; | 281 << ", " << security_origin.spec() << ")"; |
| 278 | 282 |
| 279 media_devices_requests_.push_back(new MediaDevicesRequestInfo( | 283 media_devices_requests_.push_back(new MediaDevicesRequestInfo( |
| 280 media_devices_request, | 284 media_devices_request, |
| 281 audio_input_request_id, | 285 audio_input_request_id, |
| 282 video_input_request_id, | 286 video_input_request_id, |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 return; | 1133 return; |
| 1130 } | 1134 } |
| 1131 } | 1135 } |
| 1132 } | 1136 } |
| 1133 | 1137 |
| 1134 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { | 1138 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { |
| 1135 return !sources_waiting_for_callback_.empty(); | 1139 return !sources_waiting_for_callback_.empty(); |
| 1136 } | 1140 } |
| 1137 | 1141 |
| 1138 } // namespace content | 1142 } // namespace content |
| OLD | NEW |