shithub: openh264

Download patch

ref: 901a599b360bafe30da9663c5bfe3d923ed5a026
parent: cc5978b2523900bb7fe06a0b8cade381eb991517
author: Martin Storsjö <[email protected]>
date: Mon Dec 8 06:48:31 EST 2014

Add casts when converting from int64_t or double to int32_t

This fixes warnings when building with MSVC.

--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -821,7 +821,7 @@
     pEncCtx->iCheckWindowCurrentTs = pEncCtx->iCheckWindowStartTs = uiTimeStamp;
     pEncCtx->bCheckWindowStatusRefreshFlag = true;
   }
-  pEncCtx->iCheckWindowInterval = pEncCtx->iCheckWindowCurrentTs - pEncCtx->iCheckWindowStartTs;
+  pEncCtx->iCheckWindowInterval = (int32_t) (pEncCtx->iCheckWindowCurrentTs - pEncCtx->iCheckWindowStartTs);
   if(pEncCtx->iCheckWindowInterval >= (TIME_CHECK_WINDOW >> 1) && !pEncCtx->bCheckWindowShiftResetFlag) {
     pEncCtx->bCheckWindowShiftResetFlag = true;
     for (int32_t i = 0; i < iSpatialNum; i++) {
@@ -875,7 +875,7 @@
   SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
 
   if (pWelsSvcRc->iPredFrameBit != 0)
-    pWelsSvcRc->iPredFrameBit = LAST_FRAME_PREDICT_WEIGHT * pWelsSvcRc->iFrameDqBits + (1 - LAST_FRAME_PREDICT_WEIGHT) * pWelsSvcRc->iPredFrameBit;
+    pWelsSvcRc->iPredFrameBit = (int32_t) (LAST_FRAME_PREDICT_WEIGHT * pWelsSvcRc->iFrameDqBits + (1 - LAST_FRAME_PREDICT_WEIGHT) * pWelsSvcRc->iPredFrameBit);
   else
     pWelsSvcRc->iPredFrameBit = pWelsSvcRc->iFrameDqBits;