Chromium Code Reviews| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "content/public/renderer/render_frame.h" | 15 #include "content/public/renderer/render_frame.h" |
| 16 #include "content/renderer/media/media_stream.h" | 16 #include "content/renderer/media/media_stream.h" |
| 17 #include "content/renderer/media/media_stream_audio_source.h" | 17 #include "content/renderer/media/media_stream_audio_source.h" |
| 18 #include "content/renderer/media/media_stream_dispatcher.h" | 18 #include "content/renderer/media/media_stream_dispatcher.h" |
| 19 #include "content/renderer/media/media_stream_video_capturer_source.h" | 19 #include "content/renderer/media/media_stream_video_capturer_source.h" |
| 20 #include "content/renderer/media/media_stream_video_track.h" | 20 #include "content/renderer/media/media_stream_video_track.h" |
| 21 #include "content/renderer/media/peer_connection_tracker.h" | 21 #include "content/renderer/media/peer_connection_tracker.h" |
| 22 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" | 22 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
| 23 #include "content/renderer/media/webrtc_audio_capturer.h" | 23 #include "content/renderer/media/webrtc_audio_capturer.h" |
| 24 #include "content/renderer/media/webrtc_logging.h" | 24 #include "content/renderer/media/webrtc_logging.h" |
| 25 #include "content/renderer/media/webrtc_uma_histograms.h" | 25 #include "content/renderer/media/webrtc_uma_histograms.h" |
| 26 #include "content/renderer/render_thread_impl.h" | 26 #include "content/renderer/render_thread_impl.h" |
| 27 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 27 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 28 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h" | 28 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h" |
| 29 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 29 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 30 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h " | |
| 30 #include "third_party/WebKit/public/web/WebDocument.h" | 31 #include "third_party/WebKit/public/web/WebDocument.h" |
| 31 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 32 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 32 | 33 |
| 33 namespace content { | 34 namespace content { |
| 34 namespace { | 35 namespace { |
| 35 | 36 |
| 36 void CopyStreamConstraints(const blink::WebMediaConstraints& constraints, | 37 void CopyStreamConstraints(const blink::WebMediaConstraints& constraints, |
| 37 StreamOptions::Constraints* mandatory, | 38 StreamOptions::Constraints* mandatory, |
| 38 StreamOptions::Constraints* optional) { | 39 StreamOptions::Constraints* optional) { |
| 39 blink::WebVector<blink::WebMediaConstraint> mandatory_constraints; | 40 blink::WebVector<blink::WebMediaConstraint> mandatory_constraints; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 55 | 56 |
| 56 static int g_next_request_id = 0; | 57 static int g_next_request_id = 0; |
| 57 | 58 |
| 58 } // namespace | 59 } // namespace |
| 59 | 60 |
| 60 struct UserMediaClientImpl::MediaDevicesRequestInfo { | 61 struct UserMediaClientImpl::MediaDevicesRequestInfo { |
| 61 MediaDevicesRequestInfo(const blink::WebMediaDevicesRequest& request, | 62 MediaDevicesRequestInfo(const blink::WebMediaDevicesRequest& request, |
| 62 int audio_input_request_id, | 63 int audio_input_request_id, |
| 63 int video_input_request_id, | 64 int video_input_request_id, |
| 64 int audio_output_request_id) | 65 int audio_output_request_id) |
| 65 : request(request), | 66 : media_devices_request(request), |
| 66 audio_input_request_id(audio_input_request_id), | 67 audio_input_request_id(audio_input_request_id), |
| 67 video_input_request_id(video_input_request_id), | 68 video_input_request_id(video_input_request_id), |
| 68 audio_output_request_id(audio_output_request_id), | 69 audio_output_request_id(audio_output_request_id), |
| 69 has_audio_input_returned(false), | 70 has_audio_input_returned(false), |
| 70 has_video_input_returned(false), | 71 has_video_input_returned(false), |
| 71 has_audio_output_returned(false) {} | 72 has_audio_output_returned(false) {} |
| 72 | 73 |
| 73 blink::WebMediaDevicesRequest request; | 74 MediaDevicesRequestInfo( |
| 75 const blink::WebMediaStreamTrackSourcesRequest& request, | |
| 76 int audio_input_request_id, | |
| 77 int video_input_request_id) | |
| 78 : sources_request(request), | |
| 79 audio_input_request_id(audio_input_request_id), | |
| 80 video_input_request_id(video_input_request_id), | |
| 81 audio_output_request_id(-1), | |
| 82 has_audio_input_returned(false), | |
| 83 has_video_input_returned(false), | |
| 84 has_audio_output_returned(false) {} | |
| 85 | |
| 86 blink::WebMediaDevicesRequest media_devices_request; | |
| 87 blink::WebMediaStreamTrackSourcesRequest sources_request; | |
| 74 int audio_input_request_id; | 88 int audio_input_request_id; |
| 75 int video_input_request_id; | 89 int video_input_request_id; |
| 76 int audio_output_request_id; | 90 int audio_output_request_id; |
| 77 bool has_audio_input_returned; | 91 bool has_audio_input_returned; |
| 78 bool has_video_input_returned; | 92 bool has_video_input_returned; |
| 79 bool has_audio_output_returned; | 93 bool has_audio_output_returned; |
| 80 StreamDeviceInfoArray audio_input_devices; | 94 StreamDeviceInfoArray audio_input_devices; |
| 81 StreamDeviceInfoArray video_input_devices; | 95 StreamDeviceInfoArray video_input_devices; |
| 82 StreamDeviceInfoArray audio_output_devices; | 96 StreamDeviceInfoArray audio_output_devices; |
| 83 }; | 97 }; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 void UserMediaClientImpl::cancelMediaDevicesRequest( | 267 void UserMediaClientImpl::cancelMediaDevicesRequest( |
| 254 const blink::WebMediaDevicesRequest& media_devices_request) { | 268 const blink::WebMediaDevicesRequest& media_devices_request) { |
| 255 DCHECK(CalledOnValidThread()); | 269 DCHECK(CalledOnValidThread()); |
| 256 MediaDevicesRequestInfo* request = | 270 MediaDevicesRequestInfo* request = |
| 257 FindMediaDevicesRequestInfo(media_devices_request); | 271 FindMediaDevicesRequestInfo(media_devices_request); |
| 258 if (!request) | 272 if (!request) |
| 259 return; | 273 return; |
| 260 CancelAndDeleteMediaDevicesRequest(request); | 274 CancelAndDeleteMediaDevicesRequest(request); |
| 261 } | 275 } |
| 262 | 276 |
| 277 void UserMediaClientImpl::requestSources( | |
| 278 const blink::WebMediaStreamTrackSourcesRequest& sources_request) { | |
| 279 // TODO | |
|
perkj_chrome
2014/09/10 15:17:39
need name name and fix indentation. Is this intent
Henrik Grunell
2014/09/12 10:58:25
Removed, it's counted in blink.
| |
| 280 // UpdateWebRTCMethodCount(WEBKIT_GET_MEDIA_DEVICES); | |
| 281 DCHECK(CalledOnValidThread()); | |
| 282 | |
| 283 int audio_input_request_id = g_next_request_id++; | |
| 284 int video_input_request_id = g_next_request_id++; | |
| 285 | |
| 286 // |sources_request| can't be mocked, so in tests it will be empty (the | |
| 287 // underlying pointer is null). In order to use this function in a test we | |
| 288 // need to check if it isNull. | |
| 289 GURL security_origin; | |
| 290 if (!sources_request.isNull()) | |
| 291 security_origin = GURL(sources_request.origin().utf8()); | |
| 292 | |
| 293 DVLOG(1) << "UserMediaClientImpl::requestSources(" | |
| 294 << audio_input_request_id | |
| 295 << ", " << video_input_request_id | |
| 296 << ", " << security_origin.spec() << ")"; | |
| 297 | |
| 298 media_devices_requests_.push_back(new MediaDevicesRequestInfo( | |
| 299 sources_request, | |
| 300 audio_input_request_id, | |
| 301 video_input_request_id)); | |
| 302 | |
| 303 media_stream_dispatcher_->EnumerateDevices( | |
| 304 audio_input_request_id, | |
| 305 weak_factory_.GetWeakPtr(), | |
| 306 MEDIA_DEVICE_AUDIO_CAPTURE, | |
| 307 security_origin); | |
| 308 | |
| 309 media_stream_dispatcher_->EnumerateDevices( | |
| 310 video_input_request_id, | |
| 311 weak_factory_.GetWeakPtr(), | |
| 312 MEDIA_DEVICE_VIDEO_CAPTURE, | |
| 313 security_origin); | |
| 314 } | |
| 315 | |
| 263 // Callback from MediaStreamDispatcher. | 316 // Callback from MediaStreamDispatcher. |
| 264 // The requested stream have been generated by the MediaStreamDispatcher. | 317 // The requested stream have been generated by the MediaStreamDispatcher. |
| 265 void UserMediaClientImpl::OnStreamGenerated( | 318 void UserMediaClientImpl::OnStreamGenerated( |
| 266 int request_id, | 319 int request_id, |
| 267 const std::string& label, | 320 const std::string& label, |
| 268 const StreamDeviceInfoArray& audio_array, | 321 const StreamDeviceInfoArray& audio_array, |
| 269 const StreamDeviceInfoArray& video_array) { | 322 const StreamDeviceInfoArray& video_array) { |
| 270 DCHECK(CalledOnValidThread()); | 323 DCHECK(CalledOnValidThread()); |
| 271 DVLOG(1) << "UserMediaClientImpl::OnStreamGenerated stream:" << label; | 324 DVLOG(1) << "UserMediaClientImpl::OnStreamGenerated stream:" << label; |
| 272 | 325 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 media_stream_dispatcher_->StopStreamDevice(*device_it); | 382 media_stream_dispatcher_->StopStreamDevice(*device_it); |
| 330 } | 383 } |
| 331 | 384 |
| 332 for (StreamDeviceInfoArray::const_iterator device_it = video_array.begin(); | 385 for (StreamDeviceInfoArray::const_iterator device_it = video_array.begin(); |
| 333 device_it != video_array.end(); ++device_it) { | 386 device_it != video_array.end(); ++device_it) { |
| 334 if (!FindLocalSource(*device_it)) | 387 if (!FindLocalSource(*device_it)) |
| 335 media_stream_dispatcher_->StopStreamDevice(*device_it); | 388 media_stream_dispatcher_->StopStreamDevice(*device_it); |
| 336 } | 389 } |
| 337 } | 390 } |
| 338 | 391 |
| 392 void UserMediaClientImpl::FinalizeEnumerateDevices( | |
| 393 MediaDevicesRequestInfo* request) { | |
| 394 // All devices are ready for copying. We use a hashed audio output device id | |
| 395 // as the group id for input and output audio devices. If an input device | |
| 396 // doesn't have an associated output device, we use the input device's own id. | |
| 397 // We don't support group id for video devices, that's left empty. | |
| 398 blink::WebVector<blink::WebMediaDeviceInfo> | |
| 399 devices(request->audio_input_devices.size() + | |
| 400 request->video_input_devices.size() + | |
| 401 request->audio_output_devices.size()); | |
| 402 for (size_t i = 0; i < request->audio_input_devices.size(); ++i) { | |
| 403 const MediaStreamDevice& device = request->audio_input_devices[i].device; | |
| 404 DCHECK_EQ(device.type, MEDIA_DEVICE_AUDIO_CAPTURE); | |
| 405 std::string group_id = base::UintToString(base::Hash( | |
| 406 !device.matched_output_device_id.empty() ? | |
| 407 device.matched_output_device_id : | |
| 408 device.id)); | |
| 409 devices[i].initialize( | |
| 410 blink::WebString::fromUTF8(device.id), | |
| 411 blink::WebMediaDeviceInfo::MediaDeviceKindAudioInput, | |
| 412 blink::WebString::fromUTF8(device.name), | |
| 413 blink::WebString::fromUTF8(group_id)); | |
| 414 } | |
| 415 size_t offset = request->audio_input_devices.size(); | |
| 416 for (size_t i = 0; i < request->video_input_devices.size(); ++i) { | |
| 417 const MediaStreamDevice& device = request->video_input_devices[i].device; | |
| 418 DCHECK_EQ(device.type, MEDIA_DEVICE_VIDEO_CAPTURE); | |
| 419 devices[offset + i].initialize( | |
| 420 blink::WebString::fromUTF8(device.id), | |
| 421 blink::WebMediaDeviceInfo::MediaDeviceKindVideoInput, | |
| 422 blink::WebString::fromUTF8(device.name), | |
| 423 blink::WebString()); | |
| 424 } | |
| 425 offset += request->video_input_devices.size(); | |
| 426 for (size_t i = 0; i < request->audio_output_devices.size(); ++i) { | |
| 427 const MediaStreamDevice& device = request->audio_output_devices[i].device; | |
| 428 DCHECK_EQ(device.type, MEDIA_DEVICE_AUDIO_OUTPUT); | |
| 429 devices[offset + i].initialize( | |
| 430 blink::WebString::fromUTF8(device.id), | |
| 431 blink::WebMediaDeviceInfo::MediaDeviceKindAudioOutput, | |
| 432 blink::WebString::fromUTF8(device.name), | |
| 433 blink::WebString::fromUTF8(base::UintToString(base::Hash(device.id)))); | |
| 434 } | |
| 435 | |
| 436 EnumerateDevicesSucceded(&request->media_devices_request, devices); | |
| 437 CancelAndDeleteMediaDevicesRequest(request); | |
|
perkj_chrome
2014/09/10 15:17:39
code duplication. Can you move line 437 and 479 to
Henrik Grunell
2014/09/12 10:58:25
Well, it's not really duplicated. Above sets up a
perkj_chrome
2014/09/12 12:35:33
CancelAndDeleteMediaDevicesRequest is duplicated a
Henrik Grunell
2014/09/12 12:59:31
Done.
| |
| 438 } | |
| 439 | |
| 440 void UserMediaClientImpl::FinalizeEnumerateSources( | |
| 441 MediaDevicesRequestInfo* request) { | |
| 442 blink::WebVector<blink::WebSourceInfo> | |
| 443 sources(request->audio_input_devices.size() + | |
| 444 request->video_input_devices.size()); | |
| 445 for (size_t i = 0; i < request->audio_input_devices.size(); ++i) { | |
| 446 const MediaStreamDevice& device = request->audio_input_devices[i].device; | |
| 447 DCHECK_EQ(device.type, MEDIA_DEVICE_AUDIO_CAPTURE); | |
| 448 std::string group_id = base::UintToString(base::Hash( | |
| 449 !device.matched_output_device_id.empty() ? | |
| 450 device.matched_output_device_id : | |
| 451 device.id)); | |
| 452 sources[i].initialize(blink::WebString::fromUTF8(device.id), | |
| 453 blink::WebSourceInfo::SourceKindAudio, | |
| 454 blink::WebString::fromUTF8(device.name), | |
| 455 blink::WebSourceInfo::VideoFacingModeNone); | |
| 456 } | |
| 457 size_t offset = request->audio_input_devices.size(); | |
| 458 for (size_t i = 0; i < request->video_input_devices.size(); ++i) { | |
| 459 const MediaStreamDevice& device = request->video_input_devices[i].device; | |
| 460 DCHECK_EQ(device.type, MEDIA_DEVICE_VIDEO_CAPTURE); | |
| 461 blink::WebSourceInfo::VideoFacingMode video_facing; | |
| 462 switch (device.video_facing) { | |
| 463 case MEDIA_VIDEO_FACING_USER: | |
| 464 video_facing = blink::WebSourceInfo::VideoFacingModeUser; | |
| 465 break; | |
| 466 case MEDIA_VIDEO_FACING_ENVIRONMENT: | |
| 467 video_facing = blink::WebSourceInfo::VideoFacingModeEnvironment; | |
| 468 break; | |
| 469 default: | |
| 470 video_facing = blink::WebSourceInfo::VideoFacingModeNone; | |
| 471 } | |
| 472 sources[offset + i].initialize(blink::WebString::fromUTF8(device.id), | |
| 473 blink::WebSourceInfo::SourceKindVideo, | |
| 474 blink::WebString::fromUTF8(device.name), | |
| 475 video_facing); | |
| 476 } | |
| 477 | |
| 478 EnumerateSourcesSucceded(&request->sources_request, sources); | |
| 479 CancelAndDeleteMediaDevicesRequest(request); | |
| 480 } | |
| 481 | |
| 339 // Callback from MediaStreamDispatcher. | 482 // Callback from MediaStreamDispatcher. |
| 340 // The requested stream failed to be generated. | 483 // The requested stream failed to be generated. |
| 341 void UserMediaClientImpl::OnStreamGenerationFailed( | 484 void UserMediaClientImpl::OnStreamGenerationFailed( |
| 342 int request_id, | 485 int request_id, |
| 343 MediaStreamRequestResult result) { | 486 MediaStreamRequestResult result) { |
| 344 DCHECK(CalledOnValidThread()); | 487 DCHECK(CalledOnValidThread()); |
| 345 DVLOG(1) << "UserMediaClientImpl::OnStreamGenerationFailed(" | 488 DVLOG(1) << "UserMediaClientImpl::OnStreamGenerationFailed(" |
| 346 << request_id << ")"; | 489 << request_id << ")"; |
| 347 UserMediaRequestInfo* request_info = FindUserMediaRequestInfo(request_id); | 490 UserMediaRequestInfo* request_info = FindUserMediaRequestInfo(request_id); |
| 348 if (!request_info) { | 491 if (!request_info) { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 DCHECK(request->video_input_devices.empty()); | 673 DCHECK(request->video_input_devices.empty()); |
| 531 request->video_input_devices = device_array; | 674 request->video_input_devices = device_array; |
| 532 } else { | 675 } else { |
| 533 DCHECK_EQ(request->audio_output_request_id, request_id); | 676 DCHECK_EQ(request->audio_output_request_id, request_id); |
| 534 request->has_audio_output_returned = true; | 677 request->has_audio_output_returned = true; |
| 535 DCHECK(request->audio_output_devices.empty()); | 678 DCHECK(request->audio_output_devices.empty()); |
| 536 request->audio_output_devices = device_array; | 679 request->audio_output_devices = device_array; |
| 537 } | 680 } |
| 538 | 681 |
| 539 if (!request->has_audio_input_returned || | 682 if (!request->has_audio_input_returned || |
| 540 !request->has_video_input_returned || | 683 !request->has_video_input_returned) { |
| 541 !request->has_audio_output_returned) { | |
| 542 // Wait for the rest of the devices to complete. | 684 // Wait for the rest of the devices to complete. |
| 543 return; | 685 return; |
| 544 } | 686 } |
| 545 | 687 |
| 546 // All devices are ready for copying. We use a hashed audio output device id | 688 bool audio_output_devices_requested = request->audio_output_request_id != -1; |
| 547 // as the group id for input and output audio devices. If an input device | 689 |
| 548 // doesn't have an associated output device, we use the input device's own id. | 690 if (audio_output_devices_requested && !request->has_audio_output_returned) { |
| 549 // We don't support group id for video devices, that's left empty. | 691 // Wait for the rest of the audio output devices to complete. |
| 550 blink::WebVector<blink::WebMediaDeviceInfo> | 692 return; |
| 551 devices(request->audio_input_devices.size() + | |
| 552 request->video_input_devices.size() + | |
| 553 request->audio_output_devices.size()); | |
| 554 for (size_t i = 0; i < request->audio_input_devices.size(); ++i) { | |
| 555 const MediaStreamDevice& device = request->audio_input_devices[i].device; | |
| 556 DCHECK_EQ(device.type, MEDIA_DEVICE_AUDIO_CAPTURE); | |
| 557 std::string group_id = base::UintToString(base::Hash( | |
| 558 !device.matched_output_device_id.empty() ? | |
| 559 device.matched_output_device_id : | |
| 560 device.id)); | |
| 561 devices[i].initialize( | |
| 562 blink::WebString::fromUTF8(device.id), | |
| 563 blink::WebMediaDeviceInfo::MediaDeviceKindAudioInput, | |
| 564 blink::WebString::fromUTF8(device.name), | |
| 565 blink::WebString::fromUTF8(group_id)); | |
| 566 } | |
| 567 size_t offset = request->audio_input_devices.size(); | |
| 568 for (size_t i = 0; i < request->video_input_devices.size(); ++i) { | |
| 569 const MediaStreamDevice& device = request->video_input_devices[i].device; | |
| 570 DCHECK_EQ(device.type, MEDIA_DEVICE_VIDEO_CAPTURE); | |
| 571 devices[offset + i].initialize( | |
| 572 blink::WebString::fromUTF8(device.id), | |
| 573 blink::WebMediaDeviceInfo::MediaDeviceKindVideoInput, | |
| 574 blink::WebString::fromUTF8(device.name), | |
| 575 blink::WebString()); | |
| 576 } | |
| 577 offset += request->video_input_devices.size(); | |
| 578 for (size_t i = 0; i < request->audio_output_devices.size(); ++i) { | |
| 579 const MediaStreamDevice& device = request->audio_output_devices[i].device; | |
| 580 DCHECK_EQ(device.type, MEDIA_DEVICE_AUDIO_OUTPUT); | |
| 581 devices[offset + i].initialize( | |
| 582 blink::WebString::fromUTF8(device.id), | |
| 583 blink::WebMediaDeviceInfo::MediaDeviceKindAudioOutput, | |
| 584 blink::WebString::fromUTF8(device.name), | |
| 585 blink::WebString::fromUTF8(base::UintToString(base::Hash(device.id)))); | |
| 586 } | 693 } |
| 587 | 694 |
| 588 EnumerateDevicesSucceded(&request->request, devices); | 695 if (audio_output_devices_requested) |
|
perkj_chrome
2014/09/10 15:17:39
why not check what type of request this is by look
Henrik Grunell
2014/09/12 10:58:25
Yes, that's better. Done.
| |
| 589 CancelAndDeleteMediaDevicesRequest(request); | 696 FinalizeEnumerateDevices(request); |
| 697 else | |
| 698 FinalizeEnumerateSources(request); | |
| 590 } | 699 } |
| 591 | 700 |
| 592 void UserMediaClientImpl::OnDeviceOpened( | 701 void UserMediaClientImpl::OnDeviceOpened( |
| 593 int request_id, | 702 int request_id, |
| 594 const std::string& label, | 703 const std::string& label, |
| 595 const StreamDeviceInfo& video_device) { | 704 const StreamDeviceInfo& video_device) { |
| 596 DVLOG(1) << "UserMediaClientImpl::OnDeviceOpened(" | 705 DVLOG(1) << "UserMediaClientImpl::OnDeviceOpened(" |
| 597 << request_id << ", " << label << ")"; | 706 << request_id << ", " << label << ")"; |
| 598 NOTIMPLEMENTED(); | 707 NOTIMPLEMENTED(); |
| 599 } | 708 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 668 break; | 777 break; |
| 669 } | 778 } |
| 670 } | 779 } |
| 671 | 780 |
| 672 void UserMediaClientImpl::EnumerateDevicesSucceded( | 781 void UserMediaClientImpl::EnumerateDevicesSucceded( |
| 673 blink::WebMediaDevicesRequest* request, | 782 blink::WebMediaDevicesRequest* request, |
| 674 blink::WebVector<blink::WebMediaDeviceInfo>& devices) { | 783 blink::WebVector<blink::WebMediaDeviceInfo>& devices) { |
| 675 request->requestSucceeded(devices); | 784 request->requestSucceeded(devices); |
| 676 } | 785 } |
| 677 | 786 |
| 787 void UserMediaClientImpl::EnumerateSourcesSucceded( | |
| 788 blink::WebMediaStreamTrackSourcesRequest* request, | |
| 789 blink::WebVector<blink::WebSourceInfo>& sources) { | |
| 790 request->requestSucceeded(sources); | |
| 791 } | |
| 792 | |
| 678 const blink::WebMediaStreamSource* UserMediaClientImpl::FindLocalSource( | 793 const blink::WebMediaStreamSource* UserMediaClientImpl::FindLocalSource( |
| 679 const StreamDeviceInfo& device) const { | 794 const StreamDeviceInfo& device) const { |
| 680 for (LocalStreamSources::const_iterator it = local_sources_.begin(); | 795 for (LocalStreamSources::const_iterator it = local_sources_.begin(); |
| 681 it != local_sources_.end(); ++it) { | 796 it != local_sources_.end(); ++it) { |
| 682 MediaStreamSource* const source = | 797 MediaStreamSource* const source = |
| 683 static_cast<MediaStreamSource*>(it->extraData()); | 798 static_cast<MediaStreamSource*>(it->extraData()); |
| 684 const StreamDeviceInfo& active_device = source->device_info(); | 799 const StreamDeviceInfo& active_device = source->device_info(); |
| 685 if (active_device.device.id == device.device.id && | 800 if (active_device.device.id == device.device.id && |
| 686 active_device.device.type == device.device.type && | 801 active_device.device.type == device.device.type && |
| 687 active_device.session_id == device.session_id) { | 802 active_device.session_id == device.session_id) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 } | 875 } |
| 761 } | 876 } |
| 762 return NULL; | 877 return NULL; |
| 763 } | 878 } |
| 764 | 879 |
| 765 UserMediaClientImpl::MediaDevicesRequestInfo* | 880 UserMediaClientImpl::MediaDevicesRequestInfo* |
| 766 UserMediaClientImpl::FindMediaDevicesRequestInfo( | 881 UserMediaClientImpl::FindMediaDevicesRequestInfo( |
| 767 const blink::WebMediaDevicesRequest& request) { | 882 const blink::WebMediaDevicesRequest& request) { |
| 768 MediaDevicesRequests::iterator it = media_devices_requests_.begin(); | 883 MediaDevicesRequests::iterator it = media_devices_requests_.begin(); |
| 769 for (; it != media_devices_requests_.end(); ++it) { | 884 for (; it != media_devices_requests_.end(); ++it) { |
| 770 if ((*it)->request == request) | 885 if ((*it)->media_devices_request == request) |
| 771 return (*it); | 886 return (*it); |
| 772 } | 887 } |
| 773 return NULL; | 888 return NULL; |
| 774 } | 889 } |
| 775 | 890 |
| 776 void UserMediaClientImpl::CancelAndDeleteMediaDevicesRequest( | 891 void UserMediaClientImpl::CancelAndDeleteMediaDevicesRequest( |
| 777 MediaDevicesRequestInfo* request) { | 892 MediaDevicesRequestInfo* request) { |
| 778 MediaDevicesRequests::iterator it = media_devices_requests_.begin(); | 893 MediaDevicesRequests::iterator it = media_devices_requests_.begin(); |
| 779 for (; it != media_devices_requests_.end(); ++it) { | 894 for (; it != media_devices_requests_.end(); ++it) { |
| 780 if ((*it) == request) { | 895 if ((*it) == request) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 946 return; | 1061 return; |
| 947 } | 1062 } |
| 948 } | 1063 } |
| 949 } | 1064 } |
| 950 | 1065 |
| 951 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { | 1066 bool UserMediaClientImpl::UserMediaRequestInfo::HasPendingSources() const { |
| 952 return !sources_waiting_for_callback_.empty(); | 1067 return !sources_waiting_for_callback_.empty(); |
| 953 } | 1068 } |
| 954 | 1069 |
| 955 } // namespace content | 1070 } // namespace content |
| OLD | NEW |