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

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

Issue 2743543004: Speculative fix for division by zero in Vp8EncoderImpl. (Closed)
Patch Set: Fix nit. 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..fec5c4c33b6e7163598ebba8bac344f7bc80f4fa 100644
--- a/webrtc/modules/video_coding/media_optimization.cc
+++ b/webrtc/modules/video_coding/media_optimization.cc
@@ -10,6 +10,8 @@
#include "webrtc/modules/video_coding/media_optimization.h"
+#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 +131,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;
tommi 2017/03/10 12:55:45 should we have a check here? At least RTC_DCHECK(
stefan-webrtc 2017/03/10 13:06:55 framerate == 0 is handled outside this class, whic
}
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