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 const StreamDeviceInfo& info = |
| 671 audio_input_device_manager_->GetOpenedDeviceInfoById( |
| 672 capture_session_id); |
| 673 DCHECK_EQ(info.device.id, device_it->device.id); |
| 674 device_it->device.sample_rate = info.device.sample_rate; |
| 675 device_it->device.channel_layout = info.device.channel_layout; |
669 audio_devices.push_back(*device_it); | 676 audio_devices.push_back(*device_it); |
670 } else if (IsVideoMediaType(device_it->device.type)) { | 677 } else if (IsVideoMediaType(device_it->device.type)) { |
671 video_devices.push_back(*device_it); | 678 video_devices.push_back(*device_it); |
672 } else { | 679 } else { |
673 NOTREACHED(); | 680 NOTREACHED(); |
674 } | 681 } |
675 } | 682 } |
676 | 683 |
677 request->requester->StreamGenerated(label, audio_devices, video_devices); | 684 request->requester->StreamGenerated(label, audio_devices, video_devices); |
678 NotifyDevicesOpened(*request); | 685 NotifyDevicesOpened(*request); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 } | 1084 } |
1078 | 1085 |
1079 // Always do enumeration even though some enumeration is in progress, | 1086 // Always do enumeration even though some enumeration is in progress, |
1080 // because those enumeration commands could be sent before these devices | 1087 // because those enumeration commands could be sent before these devices |
1081 // change. | 1088 // change. |
1082 ++active_enumeration_ref_count_[stream_type]; | 1089 ++active_enumeration_ref_count_[stream_type]; |
1083 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); | 1090 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); |
1084 } | 1091 } |
1085 | 1092 |
1086 } // namespace content | 1093 } // namespace content |
OLD | NEW |