ref: 5cad0f9bba0dae49e9ce0d45cabe33d8bed157ed
parent: bf35b6fee791dda2ba378a4c8aa9ebc455967856
author: sijchen <[email protected]>
date: Mon Jan 11 17:01:02 EST 2016
enhance a UT to cover more case
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2500,14 +2500,6 @@
return iRet;
}
- if (pCodingParam->iMultipleThreadIdc > 1) {
- iRet = CreateSliceThreads (pCtx);
- if (iRet != 0) {
- WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitEncoderExt(), CreateSliceThreads failed return %d.", iRet);
- FreeMemorySvc (&pCtx);
- return iRet;
- }
- }
if (pCodingParam->iEntropyCodingModeFlag)
WelsCabacInit (pCtx);
WelsRcInitModule (pCtx, pCtx->pSvcParam->iRCMode);
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -334,11 +334,9 @@
pSmt->pThreadBsBuffer[iIdx] = NULL;
}
- //previous conflict
WelsSnprintf (name, SEM_NAME_MAX, "scm%s", pSmt->eventNamespace);
err = WelsEventOpen (&pSmt->pSliceCodedMasterEvent, name);
MT_TRACE_LOG (*ppCtx, WELS_LOG_INFO, "[MT] Open pSliceCodedMasterEvent named(%s) ret%d err%d", name, err, errno);
- //previous conflict ends
iReturn = WelsMutexInit (&pSmt->mutexSliceNumUpdate);
WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
--- a/test/api/encode_options_test.cpp
+++ b/test/api/encode_options_test.cpp
@@ -1447,15 +1447,19 @@
sParam.bSimulcastAVC = 1;
sParam.sSpatialLayers[0].iVideoWidth = (iWidth >> 2);
sParam.sSpatialLayers[0].iVideoHeight = (iHeight >> 2);
- sParam.sSpatialLayers[0].sSliceArgument.uiSliceMode = SM_SIZELIMITED_SLICE;
+ sParam.sSpatialLayers[0].sSliceArgument.uiSliceMode = (rand() % 2) ? SM_SIZELIMITED_SLICE : SM_FIXEDSLCNUM_SLICE;
sParam.sSpatialLayers[0].sSliceArgument.uiSliceSizeConstraint = 1500;
sParam.sSpatialLayers[1].iVideoWidth = iWidth;
sParam.sSpatialLayers[1].iVideoHeight = iHeight;
- sParam.sSpatialLayers[1].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
+ sParam.sSpatialLayers[1].sSliceArgument.uiSliceMode = (rand() % 2) ? SM_SIZELIMITED_SLICE : SM_FIXEDSLCNUM_SLICE;
sParam.sSpatialLayers[1].sSliceArgument.uiSliceNum = 1;
+ sParam.sSpatialLayers[1].sSliceArgument.uiSliceSizeConstraint = 1500;
- int rv = encoder_->InitializeExt (&sParam);
+ int iTraceLevel = WELS_LOG_QUIET;
+ int rv = encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
+
+ rv = encoder_->InitializeExt (&sParam);
ASSERT_TRUE (rv == cmResultSuccess) << "Init Failed sParam: rv = " << rv;;
unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM];
@@ -1568,14 +1572,18 @@
SEncParamExt sParam;
encoder_->GetDefaultParams (&sParam);
prepareParamDefault (iSpatialLayerNum, 1, iWidth, iHeight, fFrameRate, &sParam);
- sParam.iMultipleThreadIdc = (rand() % 8) + 1;
+ sParam.iMultipleThreadIdc = 4;
sParam.bSimulcastAVC = 1;
sParam.sSpatialLayers[0].iVideoWidth = iWidth;
sParam.sSpatialLayers[0].iVideoHeight = iHeight;
sParam.sSpatialLayers[0].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
+ //TODO: use this after the buffer problem is fixed. sParam.sSpatialLayers[0].sSliceArgument.uiSliceMode = (rand()%2) ? SM_FIXEDSLCNUM_SLICE : SM_SIZELIMITED_SLICE;
sParam.sSpatialLayers[0].sSliceArgument.uiSliceNum = sParam.iMultipleThreadIdc;
+ sParam.sSpatialLayers[0].sSliceArgument.uiSliceSizeConstraint = 1000;
- int rv = encoder_->InitializeExt (&sParam);
+ int iTraceLevel = WELS_LOG_QUIET;
+ int rv = encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
+ rv = encoder_->InitializeExt (&sParam);
ASSERT_TRUE (rv == cmResultSuccess) << "Init Failed sParam: rv = " << rv;;
unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM];