#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_sets.h"
#include <cmath>
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/modules/mediastream/media_constraints.h"
#include "third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.h"
namespace blink {
namespace media_constraints {
Point;
namespace {
constexpr double kTolerance = …;
bool AreApproximatelyEqual(double d1, double d2) { … }
bool IsLess(double d1, double d2) { … }
bool IsLessOrEqual(double d1, double d2) { … }
bool IsGreater(double d1, double d2) { … }
bool IsGreaterOrEqual(double d1, double d2) { … }
int ToValidDimension(int dimension) { … }
int MinDimensionFromConstraint(const LongConstraint& constraint) { … }
int MaxDimensionFromConstraint(const LongConstraint& constraint) { … }
double ToValidAspectRatio(double aspect_ratio) { … }
double MinAspectRatioFromConstraint(const DoubleConstraint& constraint) { … }
double MaxAspectRatioFromConstraint(const DoubleConstraint& constraint) { … }
bool IsPositiveFiniteAspectRatio(double aspect_ratio) { … }
Point GetClosestPointToVertexOrSide(const Vector<Point> vertices,
const Point& point) { … }
Point SelectPointWithLargestArea(const Point& p1, const Point& p2) { … }
}
Point::Point(double height, double width) : … { … }
Point::Point(const Point& other) = default;
Point& Point::operator=(const Point& other) = default;
bool Point::operator==(const Point& other) const { … }
bool Point::operator!=(const Point& other) const { … }
bool Point::IsApproximatelyEqualTo(const Point& other) const { … }
Point Point::operator+(const Point& other) const { … }
Point Point::operator-(const Point& other) const { … }
Point operator*(double d, const Point& p) { … }
double Point::Dot(const Point& p1, const Point& p2) { … }
double Point::SquareEuclideanDistance(const Point& p1, const Point& p2) { … }
Point Point::ClosestPointInSegment(const Point& p,
const Point& s1,
const Point& s2) { … }
ResolutionSet::ResolutionSet(int min_height,
int max_height,
int min_width,
int max_width,
double min_aspect_ratio,
double max_aspect_ratio)
: … { … }
ResolutionSet::ResolutionSet()
: … { … }
ResolutionSet::ResolutionSet(const ResolutionSet& other) = default;
ResolutionSet& ResolutionSet::operator=(const ResolutionSet& other) = default;
bool ResolutionSet::IsHeightEmpty() const { … }
bool ResolutionSet::IsWidthEmpty() const { … }
bool ResolutionSet::IsAspectRatioEmpty() const { … }
bool ResolutionSet::IsEmpty() const { … }
bool ResolutionSet::ContainsPoint(const Point& point) const { … }
bool ResolutionSet::ContainsPoint(int height, int width) const { … }
ResolutionSet ResolutionSet::Intersection(const ResolutionSet& other) const { … }
Point ResolutionSet::SelectClosestPointToIdeal(
const MediaTrackConstraintSetPlatform& constraint_set,
int default_height,
int default_width) const { … }
Point ResolutionSet::SelectClosestPointToIdealAspectRatio(
double ideal_aspect_ratio,
int default_height,
int default_width) const { … }
Point ResolutionSet::ClosestPointTo(const Point& point) const { … }
Vector<Point> ResolutionSet::GetClosestVertices(double (Point::*accessor)()
const,
double value) const { … }
ResolutionSet ResolutionSet::FromHeight(int min, int max) { … }
ResolutionSet ResolutionSet::FromExactHeight(int value) { … }
ResolutionSet ResolutionSet::FromWidth(int min, int max) { … }
ResolutionSet ResolutionSet::FromExactWidth(int value) { … }
ResolutionSet ResolutionSet::FromAspectRatio(double min, double max) { … }
ResolutionSet ResolutionSet::FromExactAspectRatio(double value) { … }
ResolutionSet ResolutionSet::FromExactResolution(int width, int height) { … }
Vector<Point> ResolutionSet::ComputeVertices() const { … }
void ResolutionSet::TryAddVertex(Vector<Point>* vertices,
const Point& point) const { … }
ResolutionSet ResolutionSet::FromConstraintSet(
const MediaTrackConstraintSetPlatform& constraint_set) { … }
DiscreteSet<std::string> StringSetFromConstraint(
const StringConstraint& constraint) { … }
DiscreteSet<bool> BoolSetFromConstraint(const BooleanConstraint& constraint) { … }
DiscreteSet<bool> RescaleSetFromConstraint(
const StringConstraint& resize_mode_constraint) { … }
}
}