#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.h"
#include <algorithm>
#include <limits>
#include <utility>
#include "third_party/blink/public/common/mediastream/media_stream_request.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_sets.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h"
namespace blink {
namespace {
template <typename P, typename T>
bool ScanConstraintsForExactValue(const MediaConstraints& constraints,
P picker,
T* value) { … }
template <typename P, typename T>
bool ScanConstraintsForMaxValue(const MediaConstraints& constraints,
P picker,
T* value) { … }
template <typename P, typename T>
bool ScanConstraintsForMinValue(const MediaConstraints& constraints,
P picker,
T* value) { … }
}
const double kMinDeviceCaptureFrameRate = …;
VideoCaptureSettings::VideoCaptureSettings() : … { … }
VideoCaptureSettings::VideoCaptureSettings(const char* failed_constraint_name)
: … { … }
VideoCaptureSettings::VideoCaptureSettings(
std::string device_id,
media::VideoCaptureParams capture_params,
std::optional<bool> noise_reduction,
const VideoTrackAdapterSettings& track_adapter_settings,
std::optional<double> min_frame_rate,
std::optional<double> max_frame_rate,
std::optional<ImageCaptureDeviceSettings> image_capture_device_settings)
: … { … }
VideoCaptureSettings::VideoCaptureSettings(const VideoCaptureSettings& other) =
default;
VideoCaptureSettings::VideoCaptureSettings(VideoCaptureSettings&& other) =
default;
VideoCaptureSettings::~VideoCaptureSettings() = default;
VideoCaptureSettings& VideoCaptureSettings::operator=(
const VideoCaptureSettings& other) = default;
VideoCaptureSettings& VideoCaptureSettings::operator=(
VideoCaptureSettings&& other) = default;
AudioCaptureSettings::AudioCaptureSettings() : … { … }
AudioCaptureSettings::AudioCaptureSettings(const char* failed_constraint_name)
: … { … }
AudioCaptureSettings::AudioCaptureSettings(
std::string device_id,
const std::optional<int>& requested_buffer_size,
bool disable_local_echo,
bool enable_automatic_output_device_selection,
ProcessingType processing_type,
const AudioProcessingProperties& audio_processing_properties,
int num_channels)
: … { … }
AudioCaptureSettings::AudioCaptureSettings(const AudioCaptureSettings& other) =
default;
AudioCaptureSettings& AudioCaptureSettings::operator=(
const AudioCaptureSettings& other) = default;
AudioCaptureSettings::AudioCaptureSettings(AudioCaptureSettings&& other) =
default;
AudioCaptureSettings& AudioCaptureSettings::operator=(
AudioCaptureSettings&& other) = default;
bool GetConstraintValueAsBoolean(
const MediaConstraints& constraints,
const BooleanConstraint MediaTrackConstraintSetPlatform::*picker,
bool* value) { … }
bool GetConstraintValueAsInteger(
const MediaConstraints& constraints,
const LongConstraint MediaTrackConstraintSetPlatform::*picker,
int* value) { … }
bool GetConstraintMinAsInteger(
const MediaConstraints& constraints,
const LongConstraint MediaTrackConstraintSetPlatform::*picker,
int* value) { … }
bool GetConstraintMaxAsInteger(
const MediaConstraints& constraints,
const LongConstraint MediaTrackConstraintSetPlatform::*picker,
int* value) { … }
bool GetConstraintValueAsDouble(
const MediaConstraints& constraints,
const DoubleConstraint MediaTrackConstraintSetPlatform::*picker,
double* value) { … }
VideoTrackAdapterSettings SelectVideoTrackAdapterSettings(
const MediaTrackConstraintSetPlatform& basic_constraint_set,
const media_constraints::ResolutionSet& resolution_set,
const media_constraints::NumericRangeSet<double>& frame_rate_set,
const media::VideoCaptureFormat& source_format,
bool enable_rescale) { … }
double NumericConstraintFitnessDistance(double value1, double value2) { … }
double StringConstraintFitnessDistance(const WebString& value,
const StringConstraint& constraint) { … }
MediaStreamSource::Capabilities ComputeCapabilitiesForVideoSource(
const String& device_id,
const media::VideoCaptureFormats& formats,
mojom::blink::FacingMode facing_mode,
bool is_device_capture,
const std::optional<std::string>& group_id) { … }
}