#include "media/base/video_adapter.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <limits>
#include <utility>
#include "absl/types/optional.h"
#include "media/base/video_common.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/time_utils.h"
namespace {
struct Fraction { … };
int roundUp(int value_to_round, int multiple, int max_value) { … }
Fraction FindScale(int input_width,
int input_height,
int target_pixels,
int max_pixels) { … }
absl::optional<std::pair<int, int>> Swap(
const absl::optional<std::pair<int, int>>& in) { … }
}
namespace cricket {
VideoAdapter::VideoAdapter(int source_resolution_alignment)
: … { … }
VideoAdapter::VideoAdapter() : … { … }
VideoAdapter::~VideoAdapter() { … }
bool VideoAdapter::DropFrame(int64_t in_timestamp_ns) { … }
bool VideoAdapter::AdaptFrameResolution(int in_width,
int in_height,
int64_t in_timestamp_ns,
int* cropped_width,
int* cropped_height,
int* out_width,
int* out_height) { … }
void VideoAdapter::OnOutputFormatRequest(
const absl::optional<VideoFormat>& format) { … }
void VideoAdapter::OnOutputFormatRequest(
const absl::optional<std::pair<int, int>>& target_aspect_ratio,
const absl::optional<int>& max_pixel_count,
const absl::optional<int>& max_fps) { … }
void VideoAdapter::OnOutputFormatRequest(
const absl::optional<std::pair<int, int>>& target_landscape_aspect_ratio,
const absl::optional<int>& max_landscape_pixel_count,
const absl::optional<std::pair<int, int>>& target_portrait_aspect_ratio,
const absl::optional<int>& max_portrait_pixel_count,
const absl::optional<int>& max_fps) { … }
void VideoAdapter::OnSinkWants(const rtc::VideoSinkWants& sink_wants) { … }
int VideoAdapter::GetTargetPixels() const { … }
float VideoAdapter::GetMaxFramerate() const { … }
std::string VideoAdapter::OutputFormatRequest::ToString() const { … }
}