ref: 94f8c351cac45bd005b937342d4bda872ec27c74
parent: 8492aac917af81807ca7b3c33d27b318e44ee3e7
author: unknown <ruil2@RUIL2-WS01.cisco.com>
date: Fri Mar 14 11:13:24 EDT 2014
fix dump file issue
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -105,7 +105,7 @@
}
static int g_LevelSetting = 0;
-int ParseLayerConfig( CReadConfig & cRdLayerCfg, const int iLayer, SEncParamExt& pSvcParam )
+int ParseLayerConfig( CReadConfig & cRdLayerCfg, const int iLayer, SEncParamExt& pSvcParam,SFilesSet& sFileSet)
{
if (!cRdLayerCfg.ExistFile()) {
fprintf (stderr, "Unabled to open layer #%d configuration file: %s.\n", iLayer, cRdLayerCfg.GetFileName().c_str());
@@ -137,13 +137,11 @@
} else if (strTag[0].compare ("FrameRateOut") == 0) {
pDLayer->fFrameRate = (float)atof (strTag[1].c_str());
}else if (strTag[0].compare ("ReconFile") == 0) {
-#ifdef ENABLE_FRAME_DUMP
const int kiLen = strTag[1].length();
- if (kiLen >= MAX_FNAME_LEN)
+ if (kiLen >= sizeof(sFileSet.sRecFileName[iLayer]))
return -1;
- pDLayer->sRecFileName[kiLen] = '\0';
- strncpy (pDLayer->sRecFileName, strTag[1].c_str(), kiLen); // confirmed_safe_unsafe_usage
-#endif//ENABLE_FRAME_DUMP
+ sFileSet.sRecFileName[iLayer][kiLen] = '\0';
+ strncpy (sFileSet.sRecFileName[iLayer], strTag[1].c_str(), kiLen); // confirmed_safe_unsafe_usage
} else if (strTag[0].compare ("ProfileIdc") == 0) {
pDLayer->uiProfileIdc = atoi (strTag[1].c_str());
} else if (strTag[0].compare ("FRExt") == 0) {
@@ -307,7 +305,7 @@
for (int8_t iLayer = 0; iLayer < kiActualLayerNum; ++ iLayer) {
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
- if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam ))
+ if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam,sFileSet ))
{
iRet = 1;
break;
@@ -483,7 +481,7 @@
for (int8_t iLayer = 0; iLayer < pSvcParam.iSpatialLayerNum; ++ iLayer) {
CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
- if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam ))
+ if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam,sFileSet ))
{
return 1;
}
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -942,7 +942,7 @@
#ifdef ENABLE_FRAME_DUMP
if(m_pEncContext->pSvcParam!=NULL){
SDumpLayer*pDump = (static_cast<SDumpLayer *>(pOption));
- WelsStrncpy(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName, pDump->pFileName, sizeof(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName))
+ WelsStrncpy(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName, sizeof(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName),pDump->pFileName);
}
#endif
}