shithub: openh264

Download patch

ref: 80f5aa216a6bca21eac52fd7d27b54e8803b6582
parent: b6502a5406ff5ff21211382f9522be1906cef9c2
author: Martin Storsjö <[email protected]>
date: Tue Feb 18 07:08:27 EST 2014

Don't copy out the SEncParamBase, manually read the individual fields instead

--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -275,6 +275,15 @@
 
    return 0;
 }
+void GetBaseParams (SEncParamBase* pCodingParam) {
+  pCodingParam->iUsageType     = iUsageType;
+  pCodingParam->iInputCsp      = iInputCsp;
+  pCodingParam->iPicWidth      = iPicWidth;
+  pCodingParam->iPicHeight     = iPicHeight;
+  pCodingParam->iTargetBitrate = iTargetBitrate;
+  pCodingParam->iRCMode        = iRCMode;
+  pCodingParam->fMaxFrameRate  = fMaxFrameRate;
+}
 int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
   float fParamMaxFrameRate		= WELS_CLIP3 (pCodingParam.fMaxFrameRate, MIN_FRAME_RATE, MAX_FRAME_RATE);
 
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -962,7 +962,7 @@
              "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n",
              m_uiCountFrameNum, m_iCspInternal);
 #endif//REC_FRAME_COUNT
-    memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SEncParamBase));	// confirmed_safe_unsafe_usage
+    m_pEncContext->pSvcParam->GetBaseParams((SEncParamBase*) pOption);
   }
   break;