Skip to content

Commit

Permalink
Prefer base::clamp() over std::clamp()
Browse files Browse the repository at this point in the history
This CL swaps out use of `std::clamp()` within `/media/gpu` in
preference to its `//base` counterpart. The former is currently
banned by Chromium style, and the latter comes with some extra
`CHECK()`s.

See also:
styleguide/c++/c++-features.md#std_clamp-banned

This CL was uploaded by git cl split.

R=hiroh@chromium.org

Bug: 1320547
Change-Id: I7629fe607a49ef020d45baf3e5bcd69c64236ded
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3612642
Auto-Submit: Kalvin Lee <kdlee@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#997509}
  • Loading branch information
Kalvin Lee authored and Chromium LUCI CQ committed Apr 29, 2022
1 parent f6b743a commit 81e1cc4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion media/gpu/mac/vt_video_decode_accelerator_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "base/atomic_sequence_num.h"
#include "base/bind.h"
#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/mac/mac_logging.h"
#include "base/mac/mac_util.h"
Expand Down Expand Up @@ -476,7 +477,7 @@ int32_t ComputeH264ReorderWindow(const H264SPS* sps) {
int max_dpb_frames =
max_dpb_mbs / ((sps->pic_width_in_mbs_minus1 + 1) *
(sps->pic_height_in_map_units_minus1 + 1));
max_dpb_frames = std::clamp(max_dpb_frames, 0, 16);
max_dpb_frames = base::clamp(max_dpb_frames, 0, 16);

// See AVC spec section E.2.1 definition of |max_num_reorder_frames|.
if (sps->vui_parameters_present_flag && sps->bitstream_restriction_flag) {
Expand Down

0 comments on commit 81e1cc4

Please sign in to comment.