ref: 91fa9fad638e2e28aebc55d500e9f5f98c446dd0
parent: d11f12db54682e80a48d352a96577e3a34b162cc
parent: fbe35cffca060bfdca70b4d860774c2824a5f7c1
author: huili2 <huili2@cisco.com>
date: Mon Jan 18 03:48:15 EST 2016
Merge pull request #2335 from mstorsjo/fix-msvc-warnings Avoid warnings in MSVC about implicitly casting floats to integers
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -1292,8 +1292,8 @@
int32_t iBitRate = pDLayerConfig->iSpatialBitrate;
int32_t iEncTimeInv = (pWelsSvcRc->uiLastTimeStamp == 0) ? 0 : (int32_t) (uiTimeStamp - pWelsSvcRc->uiLastTimeStamp);
if ((iEncTimeInv < 0) || (iEncTimeInv > 1000)) {
- pWelsSvcRc->uiLastTimeStamp = uiTimeStamp - 1000.0 / pDLayerConfig->fFrameRate;
- iEncTimeInv = 1000.0 / pDLayerConfig->fFrameRate;
+ iEncTimeInv = (int32_t) (1000.0 / pDLayerConfig->fFrameRate);
+ pWelsSvcRc->uiLastTimeStamp = uiTimeStamp - iEncTimeInv;
}
int32_t iSentBits = (int32_t) ((double)iBitRate * iEncTimeInv * (1.0E-3) + 0.5);
iSentBits = WELS_MAX (iSentBits, 0);