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

Unified Diff: webrtc/modules/video_coding/media_optimization.cc

Issue 2743543004: Speculative fix for division by zero in Vp8EncoderImpl. (Closed)
Patch Set: Created 3 years, 9 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/common_types.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/media_optimization.cc
diff --git a/webrtc/modules/video_coding/media_optimization.cc b/webrtc/modules/video_coding/media_optimization.cc
index a30ac9521abe3371567f427c661d7777e5ee86a7..49757bc366897a56dabe13839dd13bc6d3b75a33 100644
--- a/webrtc/modules/video_coding/media_optimization.cc
+++ b/webrtc/modules/video_coding/media_optimization.cc
@@ -10,6 +10,9 @@
#include "webrtc/modules/video_coding/media_optimization.h"
+// #include <algorithm>
sprang_webrtc 2017/03/10 12:38:57 remove
stefan-webrtc 2017/03/10 12:39:41 Done.
+#include <limits>
+
#include "webrtc/base/logging.h"
#include "webrtc/modules/video_coding/utility/frame_dropper.h"
#include "webrtc/system_wrappers/include/clock.h"
@@ -129,7 +132,9 @@ uint32_t MediaOptimization::InputFrameRate() {
uint32_t MediaOptimization::InputFrameRateInternal() {
ProcessIncomingFrameRate(clock_->TimeInMilliseconds());
- return uint32_t(incoming_frame_rate_ + 0.5f);
+ uint32_t framerate = static_cast<uint32_t>(std::min<float>(
+ std::numeric_limits<uint32_t>::max(), incoming_frame_rate_ + 0.5f));
+ return framerate;
}
uint32_t MediaOptimization::SentFrameRate() {
« no previous file with comments | « webrtc/common_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698