#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_audio.h"
#include <algorithm>
#include <cmath>
#include <string>
#include <tuple>
#include <utility>
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/audio/audio_features.h"
#include "media/base/audio_parameters.h"
#include "media/base/limits.h"
#include "media/base/media_switches.h"
#include "media/webrtc/constants.h"
#include "media/webrtc/webrtc_features.h"
#include "third_party/blink/public/common/mediastream/media_stream_controls.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h"
#include "third_party/blink/renderer/modules/mediastream/media_constraints.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_sets.h"
#include "third_party/blink/renderer/modules/mediastream/processed_local_audio_source.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_processor_options.h"
#include "third_party/blink/renderer/platform/mediastream/media_stream_audio_source.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
AudioCaptureSettings;
AudioProcessingProperties;
ConstraintSet;
BooleanConstraint;
EchoCancellationType;
VoiceIsolationType;
ProcessingType;
StringConstraint;
NumericRangeSet;
namespace {
BoolSet;
DoubleRangeSet;
EchoCancellationTypeSet;
VoiceIsolationTypeSet;
IntRangeSet;
StringSet;
enum class SourceType { … };
int32_t GetSampleSize() { … }
bool IsProcessingAllowedForSampleRatesNotDivisibleBy100(
mojom::blink::MediaStreamType stream_type) { … }
struct Score { … };
class SourceInfo { … };
class BooleanContainer { … };
class StringContainer { … };
template <class T, class C>
class NumericRangeSetContainer { … };
IntegerRangeContainer;
DoubleRangeContainer;
template <class T, class C>
class NumericDiscreteSetContainer { … };
IntegerDiscreteContainer;
class EchoCancellationContainer { … };
class AutoGainControlContainer { … };
class VoiceIsolationContainer { … };
Vector<int> GetApmSupportedChannels(
const media::AudioParameters& device_params) { … }
class ProcessingBasedContainer { … };
constexpr ProcessingBasedContainer::BooleanPropertyContainerInfo
ProcessingBasedContainer::kBooleanPropertyContainerInfoMap[];
class DeviceContainer { … };
constexpr DeviceContainer::BooleanPropertyContainerInfo
DeviceContainer::kBooleanPropertyContainerInfoMap[];
class CandidatesContainer { … };
std::string GetMediaStreamSource(const MediaConstraints& constraints) { … }
}
AudioDeviceCaptureCapability::AudioDeviceCaptureCapability()
: … { … }
AudioDeviceCaptureCapability::AudioDeviceCaptureCapability(
blink::MediaStreamAudioSource* source)
: … { … }
AudioDeviceCaptureCapability::AudioDeviceCaptureCapability(
String device_id,
String group_id,
const media::AudioParameters& parameters)
: … { … }
AudioDeviceCaptureCapability::AudioDeviceCaptureCapability(
const AudioDeviceCaptureCapability&) = default;
AudioDeviceCaptureCapability& AudioDeviceCaptureCapability::operator=(
const AudioDeviceCaptureCapability&) = default;
String AudioDeviceCaptureCapability::DeviceID() const { … }
String AudioDeviceCaptureCapability::GroupID() const { … }
const media::AudioParameters& AudioDeviceCaptureCapability::Parameters() const { … }
AudioCaptureSettings SelectSettingsAudioCapture(
const AudioDeviceCaptureCapabilities& capabilities,
const MediaConstraints& constraints,
mojom::blink::MediaStreamType stream_type,
bool should_disable_hardware_noise_suppression,
bool is_reconfiguration_allowed) { … }
AudioCaptureSettings SelectSettingsAudioCapture(
blink::MediaStreamAudioSource* source,
const MediaConstraints& constraints) { … }
MODULES_EXPORT base::expected<Vector<blink::AudioCaptureSettings>, std::string>
SelectEligibleSettingsAudioCapture(
const AudioDeviceCaptureCapabilities& capabilities,
const MediaConstraints& constraints,
mojom::blink::MediaStreamType stream_type,
bool should_disable_hardware_noise_suppression,
bool is_reconfiguration_allowed) { … }
std::tuple<int, int> GetMinMaxBufferSizesForAudioParameters(
const media::AudioParameters& parameters) { … }
std::tuple<double, double> GetMinMaxLatenciesForAudioParameters(
const media::AudioParameters& parameters) { … }
}