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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 device_it != devices->end(); ++device_it) { | 733 device_it != devices->end(); ++device_it) { |
734 if (IsAudioMediaType(device_it->device.type)) { | 734 if (IsAudioMediaType(device_it->device.type)) { |
735 // Store the native audio parameters in the device struct. | 735 // Store the native audio parameters in the device struct. |
736 // TODO(xians): Handle the tab capture sample rate/channel layout | 736 // TODO(xians): Handle the tab capture sample rate/channel layout |
737 // in AudioInputDeviceManager::Open(). | 737 // in AudioInputDeviceManager::Open(). |
738 if (device_it->device.type != content::MEDIA_TAB_AUDIO_CAPTURE) { | 738 if (device_it->device.type != content::MEDIA_TAB_AUDIO_CAPTURE) { |
739 const StreamDeviceInfo* info = | 739 const StreamDeviceInfo* info = |
740 audio_input_device_manager_->GetOpenedDeviceInfoById( | 740 audio_input_device_manager_->GetOpenedDeviceInfoById( |
741 device_it->session_id); | 741 device_it->session_id); |
742 DCHECK_EQ(info->device.id, device_it->device.id); | 742 DCHECK_EQ(info->device.id, device_it->device.id); |
743 device_it->device.sample_rate = info->device.sample_rate; | 743 device_it->device.input = info->device.input; |
744 device_it->device.channel_layout = info->device.channel_layout; | 744 device_it->device.matched_output = info->device.matched_output; |
745 } | 745 } |
746 audio_devices.push_back(*device_it); | 746 audio_devices.push_back(*device_it); |
747 } else if (IsVideoMediaType(device_it->device.type)) { | 747 } else if (IsVideoMediaType(device_it->device.type)) { |
748 video_devices.push_back(*device_it); | 748 video_devices.push_back(*device_it); |
749 } else { | 749 } else { |
750 NOTREACHED(); | 750 NOTREACHED(); |
751 } | 751 } |
752 } | 752 } |
753 | 753 |
754 request->requester->StreamGenerated(label, audio_devices, video_devices); | 754 request->requester->StreamGenerated(label, audio_devices, video_devices); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 // initialized. | 942 // initialized. |
943 if (device_info.device.type == content::MEDIA_TAB_AUDIO_CAPTURE) { | 943 if (device_info.device.type == content::MEDIA_TAB_AUDIO_CAPTURE) { |
944 const media::AudioParameters parameters = | 944 const media::AudioParameters parameters = |
945 audio_manager_->GetDefaultOutputStreamParameters(); | 945 audio_manager_->GetDefaultOutputStreamParameters(); |
946 int sample_rate = parameters.sample_rate(); | 946 int sample_rate = parameters.sample_rate(); |
947 // If we weren't able to get the native sampling rate or the sample_rate | 947 // If we weren't able to get the native sampling rate or the sample_rate |
948 // is outside the valid range for input devices set reasonable defaults. | 948 // is outside the valid range for input devices set reasonable defaults. |
949 if (sample_rate <= 0 || sample_rate > 96000) | 949 if (sample_rate <= 0 || sample_rate > 96000) |
950 sample_rate = 44100; | 950 sample_rate = 44100; |
951 | 951 |
952 device_info.device.sample_rate = sample_rate; | 952 device_info.device.input.sample_rate = sample_rate; |
953 device_info.device.channel_layout = media::CHANNEL_LAYOUT_STEREO; | 953 device_info.device.input.channel_layout = media::CHANNEL_LAYOUT_STEREO; |
954 } | 954 } |
955 } | 955 } |
956 | 956 |
957 // Set in_use to false to be able to track if this device has been | 957 // Set in_use to false to be able to track if this device has been |
958 // opened. in_use might be true if the device type can be used in more | 958 // opened. in_use might be true if the device type can be used in more |
959 // than one session. | 959 // than one session. |
960 device_info.in_use = false; | 960 device_info.in_use = false; |
961 | 961 |
962 device_info.session_id = | 962 device_info.session_id = |
963 GetDeviceManager(device_info.device.type)->Open(device_info); | 963 GetDeviceManager(device_info.device.type)->Open(device_info); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 } | 1106 } |
1107 | 1107 |
1108 // Always do enumeration even though some enumeration is in progress, | 1108 // Always do enumeration even though some enumeration is in progress, |
1109 // because those enumeration commands could be sent before these devices | 1109 // because those enumeration commands could be sent before these devices |
1110 // change. | 1110 // change. |
1111 ++active_enumeration_ref_count_[stream_type]; | 1111 ++active_enumeration_ref_count_[stream_type]; |
1112 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); | 1112 GetDeviceManager(stream_type)->EnumerateDevices(stream_type); |
1113 } | 1113 } |
1114 | 1114 |
1115 } // namespace content | 1115 } // namespace content |
OLD | NEW |