chromium/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_sets.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#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 =;

// Not perfect, but good enough for this application.
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) {}

// If |vertices| has a single element, return |vertices[0]|.
// If |vertices| has two elements, returns the point in the segment defined by
// |vertices| that is closest to |point|.
// |vertices| must have 1 or 2 elements. Otherwise, behavior is undefined.
// This function is called when |point| has already been determined to be
// outside a polygon and |vertices| is the vertex or side closest to |point|.
Point GetClosestPointToVertexOrSide(const Vector<Point> vertices,
                                    const Point& point) {}

Point SelectPointWithLargestArea(const Point& p1, const Point& p2) {}

}  // namespace

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) {}

// Returns the dot product between |p1| and |p2|.
// static
double Point::Dot(const Point& p1, const Point& p2) {}

// static
double Point::SquareEuclideanDistance(const Point& p1, const Point& p2) {}

// static
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 {}

// static
ResolutionSet ResolutionSet::FromHeight(int min, int max) {}

// static
ResolutionSet ResolutionSet::FromExactHeight(int value) {}

// static
ResolutionSet ResolutionSet::FromWidth(int min, int max) {}

// static
ResolutionSet ResolutionSet::FromExactWidth(int value) {}

// static
ResolutionSet ResolutionSet::FromAspectRatio(double min, double max) {}

// static
ResolutionSet ResolutionSet::FromExactAspectRatio(double value) {}

// static
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) {}

}  // namespace media_constraints
}  // namespace blink