| 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 #include "content/browser/renderer_host/media/media_devices_manager.h" | 5 #include "content/browser/renderer_host/media/media_devices_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 base::Bind(&EnumerateAudioDevicesOnDeviceThread, audio_manager_, | 377 base::Bind(&EnumerateAudioDevicesOnDeviceThread, audio_manager_, |
| 378 is_input), | 378 is_input), |
| 379 base::Bind(&MediaDevicesManager::DevicesEnumerated, | 379 base::Bind(&MediaDevicesManager::DevicesEnumerated, |
| 380 weak_factory_.GetWeakPtr(), type)); | 380 weak_factory_.GetWeakPtr(), type)); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void MediaDevicesManager::VideoInputDevicesEnumerated( | 383 void MediaDevicesManager::VideoInputDevicesEnumerated( |
| 384 const media::VideoCaptureDeviceDescriptors& descriptors) { | 384 const media::VideoCaptureDeviceDescriptors& descriptors) { |
| 385 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 385 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 386 MediaDeviceInfoArray snapshot; | 386 MediaDeviceInfoArray snapshot; |
| 387 for (const auto& descriptor : descriptors) { | 387 for (const auto& descriptor : descriptors) |
| 388 snapshot.emplace_back(descriptor.device_id, descriptor.GetNameAndModel(), | 388 snapshot.emplace_back(descriptor); |
| 389 std::string()); | |
| 390 } | |
| 391 DevicesEnumerated(MEDIA_DEVICE_TYPE_VIDEO_INPUT, snapshot); | 389 DevicesEnumerated(MEDIA_DEVICE_TYPE_VIDEO_INPUT, snapshot); |
| 392 } | 390 } |
| 393 | 391 |
| 394 void MediaDevicesManager::DevicesEnumerated( | 392 void MediaDevicesManager::DevicesEnumerated( |
| 395 MediaDeviceType type, | 393 MediaDeviceType type, |
| 396 const MediaDeviceInfoArray& snapshot) { | 394 const MediaDeviceInfoArray& snapshot) { |
| 397 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 395 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 398 DCHECK(IsValidMediaDeviceType(type)); | 396 DCHECK(IsValidMediaDeviceType(type)); |
| 399 UpdateSnapshot(type, snapshot); | 397 UpdateSnapshot(type, snapshot); |
| 400 cache_infos_[type].UpdateCompleted(); | 398 cache_infos_[type].UpdateCompleted(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 const MediaDeviceInfoArray& snapshot) { | 518 const MediaDeviceInfoArray& snapshot) { |
| 521 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 519 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 522 DCHECK(IsValidMediaDeviceType(type)); | 520 DCHECK(IsValidMediaDeviceType(type)); |
| 523 | 521 |
| 524 for (const auto& subscriber : device_change_subscribers_[type]) { | 522 for (const auto& subscriber : device_change_subscribers_[type]) { |
| 525 subscriber->OnDevicesChanged(type, snapshot); | 523 subscriber->OnDevicesChanged(type, snapshot); |
| 526 } | 524 } |
| 527 } | 525 } |
| 528 | 526 |
| 529 } // namespace content | 527 } // namespace content |
| OLD | NEW |