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/browser/renderer_host/media/media_stream_manager.h" | 5 #include "content/browser/renderer_host/media/media_stream_manager.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 return; | 656 return; |
657 } | 657 } |
658 | 658 |
659 switch (request->type) { | 659 switch (request->type) { |
660 case MEDIA_OPEN_DEVICE: | 660 case MEDIA_OPEN_DEVICE: |
661 request->requester->DeviceOpened(label, devices->front()); | 661 request->requester->DeviceOpened(label, devices->front()); |
662 break; | 662 break; |
663 case MEDIA_GENERATE_STREAM: { | 663 case MEDIA_GENERATE_STREAM: { |
664 // Partition the array of devices into audio vs video. | 664 // Partition the array of devices into audio vs video. |
665 StreamDeviceInfoArray audio_devices, video_devices; | 665 StreamDeviceInfoArray audio_devices, video_devices; |
666 for (StreamDeviceInfoArray::const_iterator device_it = devices->begin(); | 666 for (StreamDeviceInfoArray::iterator device_it = devices->begin(); |
667 device_it != devices->end(); ++device_it) { | 667 device_it != devices->end(); ++device_it) { |
668 if (IsAudioMediaType(device_it->device.type)) { | 668 if (IsAudioMediaType(device_it->device.type)) { |
| 669 // Store the native audio parameters in the device struct. |
| 670 // TODO(xians): Handle the tab capture sample rate/channel layout |
| 671 // in AudioInputDeviceManager::Open(). |
| 672 if (device_it->device.type != content::MEDIA_TAB_AUDIO_CAPTURE) { |
| 673 const StreamDeviceInfo* info = |
| 674 audio_input_device_manager_->GetOpenedDeviceInfoById( |
| 675 device_it->session_id); |
| 676 DCHECK_EQ(info->device.id, device_it->device.id); |
| 677 device_it->device.sample_rate = info->device.sample_rate; |
| 678 device_it->device.channel_layout = info->device.channel_layout; |
| 679 } |
669 audio_devices.push_back(*device_it); | 680 audio_devices.push_back(*device_it); |
670 } else if (IsVideoMediaType(device_it->device.type)) { | 681 } else if (IsVideoMediaType(device_it->device.type)) { |
671 video_devices.push_back(*device_it); | 682 video_devices.push_back(*device_it); |
672 } else { | 683 } else { |
673 NOTREACHED(); | 684 NOTREACHED(); |
674 } | 685 } |
675 } | 686 } |
676 | 687 |
677 request->requester->StreamGenerated(label, audio_devices, video_devices); | 688 request->requester->StreamGenerated(label, audio_devices, video_devices); |
678 NotifyDevicesOpened(*request); | 689 NotifyDevicesOpened(*request); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 } | 1088 } |
1078 | 1089 |
1079 // Always do enumeration even though some enumeration is in progress, | 1090 // Always do enumeration even though some enumeration is in progress, |
1080 // because those enumeration commands could be sent before these devices | 1091 // because those enumeration commands could be sent before these devices |
1081 // change. | 1092 // change. |
1082 ++active_enumeration_ref_count_[stream_type]; | 1093 ++active_enumeration_ref_count_[stream_type]; |
1083 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); | 1094 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); |
1084 } | 1095 } |
1085 | 1096 |
1086 } // namespace content | 1097 } // namespace content |
OLD | NEW |