| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_AUDIO_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_AUDIO_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_AUDIO_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_AUDIO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // empty (e.g., if there are no devices in the system). | 34 // empty (e.g., if there are no devices in the system). |
| 35 // After the basic constraint set is applied, advanced constraint sets are | 35 // After the basic constraint set is applied, advanced constraint sets are |
| 36 // applied. If no candidates can satisfy an advanced set, the advanced set is | 36 // applied. If no candidates can satisfy an advanced set, the advanced set is |
| 37 // ignored, otherwise the candidates that cannot satisfy the advanced set are | 37 // ignored, otherwise the candidates that cannot satisfy the advanced set are |
| 38 // removed. | 38 // removed. |
| 39 // Once all constraint sets are applied, the result is selected from the | 39 // Once all constraint sets are applied, the result is selected from the |
| 40 // remaining candidates by giving preference to candidates closest to the ideal | 40 // remaining candidates by giving preference to candidates closest to the ideal |
| 41 // values specified in the basic constraint set, or using default | 41 // values specified in the basic constraint set, or using default |
| 42 // implementation-specific values. | 42 // implementation-specific values. |
| 43 // The result includes the following properties: | 43 // The result includes the following properties: |
| 44 // * Device. A device is chosen using the device_id, sample_rate, sample_size, | 44 // * Device. A device can be chosen using the device_id constraint. |
| 45 // and channel_count constraints. If multiple devices satisfy the constraints | 45 // For device capture, the validity of device IDs is checked by |
| 46 // preference is given to the default device (system defined or chosen by | 46 // SelectSettings since the list of allowed device IDs is known in advance. |
| 47 // user preferences). If the default device is not included in the valid | 47 // For content capture, all device IDs are considered valid by |
| 48 // candidates, the first valid device in the list obtained by querying the | 48 // SelectSettings. Actual validation is performed by the getUserMedia |
| 49 // system capabilities is chosen. For content capture, no real audio input | 49 // implementation. |
| 50 // devices are used and the sample_rate, sample_size and channel_count | |
| 51 // constraints are ignored. In content capture, the deviceId constraint is | |
| 52 // supported and is interpreted by the system as a string that indicates, | |
| 53 // for example, which tab to capture. Validation for that "device" ID is | |
| 54 // performed by the getUserMedia implementation. To decide between content | |
| 55 // or device capture, the value of the special media_stream_source constraint | |
| 56 // is used. | |
| 57 // * Audio features: the hotword_enabled, disable_local_echo and | 50 // * Audio features: the hotword_enabled, disable_local_echo and |
| 58 // render_to_associated_sink constraints can be used to enable the | 51 // render_to_associated_sink constraints can be used to enable the |
| 59 // corresponding audio feature. If not specified, their default value is | 52 // corresponding audio feature. If not specified, their default value is |
| 60 // false. | 53 // false, except for disable_local_echo, whose default value is false only |
| 54 // for desktop capture. |
| 61 // * Audio processing. The remaining constraints are used to control audio | 55 // * Audio processing. The remaining constraints are used to control audio |
| 62 // processing. This is how audio-processing properties are set for device | 56 // processing. This is how audio-processing properties are set for device |
| 63 // capture(see the content::AudioProcessingProperties struct) : | 57 // capture(see the content::AudioProcessingProperties struct) : |
| 64 // - enable_sw_echo_cancellation: If the selected device has hardware echo | 58 // - enable_sw_echo_cancellation: If the selected device has hardware echo |
| 65 // cancellation, software echo cancellation is disabled regardless of | 59 // cancellation, software echo cancellation is disabled regardless of |
| 66 // any constraint values. Otherwise, it is enabled by default unless | 60 // any constraint values. Otherwise, it is enabled by default unless |
| 67 // either the echo_cancellation or the goog_echo_cancellation constraint | 61 // either the echo_cancellation or the goog_echo_cancellation constraint |
| 68 // has a final value of false after applying all constraint sets. Note | 62 // has a final value of false after applying all constraint sets. Note |
| 69 // that if these constraints have contradictory values, SelectSettings | 63 // that if these constraints have contradictory values, SelectSettings |
| 70 // fails and returns no value. | 64 // fails and returns no value. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 86 // constraints. Constraints are an input to SelectSettings, while properties | 80 // constraints. Constraints are an input to SelectSettings, while properties |
| 87 // are part of the output. The value for most boolean properties comes | 81 // are part of the output. The value for most boolean properties comes |
| 88 // directly from a corresponding boolean constraint, but this is not true for | 82 // directly from a corresponding boolean constraint, but this is not true for |
| 89 // all constraints and properties. For example, the echo_cancellation and | 83 // all constraints and properties. For example, the echo_cancellation and |
| 90 // goog_echo_cancellation constraints are not directly mapped to any | 84 // goog_echo_cancellation constraints are not directly mapped to any |
| 91 // property, but they, together with hardware characteristics, influence the | 85 // property, but they, together with hardware characteristics, influence the |
| 92 // enabling and disabling of software and hardware echo cancellation. | 86 // enabling and disabling of software and hardware echo cancellation. |
| 93 // Moreover, the echo_cancellation constraint influences most other | 87 // Moreover, the echo_cancellation constraint influences most other |
| 94 // audio-processing properties for which no explicit value is provided in | 88 // audio-processing properties for which no explicit value is provided in |
| 95 // their corresponding constraints. | 89 // their corresponding constraints. |
| 90 // TODO(guidou): Add support for other standard constraints such as sampleRate, |
| 91 // channelCount and groupId. http://crbug.com/731170 |
| 96 AudioCaptureSettings CONTENT_EXPORT | 92 AudioCaptureSettings CONTENT_EXPORT |
| 97 SelectSettingsAudioCapture(const AudioDeviceCaptureCapabilities& capabilities, | 93 SelectSettingsAudioCapture(const AudioDeviceCaptureCapabilities& capabilities, |
| 98 const blink::WebMediaConstraints& constraints); | 94 const blink::WebMediaConstraints& constraints); |
| 99 | 95 |
| 100 } // namespace content | 96 } // namespace content |
| 101 | 97 |
| 102 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_AUDIO_H_ | 98 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_CONSTRAINTS_UTIL_AUDIO_H_ |
| OLD | NEW |