// 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/40285824): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include "media/capabilities/bucket_utility.h" #include <algorithm> #include <cmath> #include <iterator> #include "base/check_op.h" namespace { // TODO(chcunningham): Find some authoritative list of frame rates. // Framerates in this list go way beyond typical values to account for changes // to playback rate. const int kFrameRateBuckets[] = …; // A mix of width and height dimensions for common and not-so-common resolutions // spanning 50p -> 12K. // TODO(chcunningham): Ponder these a bit more. const int kSizeBuckets[] = …; // Pixel buckets that are used to quantize the resolution to limit the amount of // information that is stored and exposed through the API. The pixel size // indices are used for logging, the pixel size buckets can therefore not be // changed unless the corresponding logging code is updated. constexpr int kWebrtcPixelsBuckets[] = …; // The boundaries between buckets are calculated as the point between the two // buckets. constexpr int kWebrtcPixelsBoundaries[] = …; // Static assert to make sure that `kWebrtcPixelsBoundaries[]` is updated if new // pixel sizes are added to kWebrtcPixelsBuckets[]`. static_assert …; } // namespace namespace media { gfx::Size GetSizeBucket(const gfx::Size& raw_size) { … } int GetFpsBucket(double raw_fps) { … } int GetWebrtcPixelsBucket(int pixels) { … } int GetWebrtcPixelsBucketIndex(int pixels) { … } } // namespace media