Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: webrtc/common_video/h264/sps_vui_rewriter.cc

Issue 2810483002: Add SafeMin() and SafeMax(), which accept args of different types (Closed)
Patch Set: trigger error earlier Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/safe_minmax_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/merge.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/h264/sps_vui_rewriter.cc
diff --git a/webrtc/common_video/h264/sps_vui_rewriter.cc b/webrtc/common_video/h264/sps_vui_rewriter.cc
index 2e118d5233b147b1f48f0268553534f8c044335b..534e75c8658655d6d6bd7438546ca71934e74d95 100644
--- a/webrtc/common_video/h264/sps_vui_rewriter.cc
+++ b/webrtc/common_video/h264/sps_vui_rewriter.cc
@@ -18,6 +18,7 @@
#include "webrtc/base/bitbuffer.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/logging.h"
+#include "webrtc/base/safe_minmax.h"
#include "webrtc/common_video/h264/h264_common.h"
#include "webrtc/common_video/h264/sps_parser.h"
@@ -351,8 +352,7 @@ bool CopyRemainingBits(rtc::BitBuffer* source,
COPY_BITS(source, destination, bits_tmp, misaligned_bits);
}
while (source->RemainingBitCount() > 0) {
- size_t count = std::min(static_cast<size_t>(32u),
- static_cast<size_t>(source->RemainingBitCount()));
+ auto count = rtc::SafeMin<size_t>(32u, source->RemainingBitCount());
COPY_BITS(source, destination, bits_tmp, count);
}
// TODO(noahric): The last byte could be all zeroes now, which we should just
« no previous file with comments | « webrtc/base/safe_minmax_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/merge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698