History

fix crash issue that temporal layer changs cause memory issue

ruil2 committed 8 years ago

Commit e0548341 parent 9edcf742 files · +65 −1Browse files

Showing the changes to test/api/encode_options_test.cpp (1 of 2 files). Show all

Unified · Split

test/api/encode_options_test.cpp+63−0
@@ -2194,3 +2194,66 @@ TEST_F (EncodeDecodeTestAPI, ScreenContent_LosslessLink0_EnableLongTermReferenc · 2193 unmodified lines
21942194 ASSERT_TRUE (iRet == cmResultSuccess) << "rv = " << iRet;
21952195
21962196 }
2197+
2198+
2199+TEST_F (EncodeDecodeTestAPI, TemporalLayerChangeDuringEncoding) {
2200+ int iWidth = 320;
2201+ int iHeight = 192;
2202+ float fFrameRate = 15;
2203+ int iSliceNum = 1;
2204+ int iRet = 0;
2205+ int iTotalFrame = 20; //total test enc frame num
2206+ int iFrameNum = 0;
2207+ SEncParamExt sParam;
2208+ encoder_->GetDefaultParams (&sParam);
2209+ prepareParamDefault (1, iSliceNum, iWidth, iHeight, fFrameRate, &sParam);
2210+ sParam.iTemporalLayerNum = 2;
2211+
2212+ //int TraceLevel = WELS_LOG_DEBUG;
2213+ //encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &TraceLevel);
2214+ iRet = encoder_->InitializeExt (&sParam);
2215+ ASSERT_TRUE (iRet == cmResultSuccess) << "InitializeExt: iRet = " << iRet << " at " << sParam.iPicWidth << "x" <<
2216+ sParam.iPicHeight;
2217+
2218+ ASSERT_TRUE (InitialEncDec (iWidth, iHeight));
2219+
2220+ int frameSize = EncPic.iPicWidth * EncPic.iPicHeight * 3 / 2;
2221+ do {
2222+ FileInputStream fileStream;
2223+ ASSERT_TRUE (fileStream.Open ("res/CiscoVT2people_320x192_12fps.yuv"));
2224+
2225+ while (fileStream.read (buf_.data(), frameSize) == frameSize) {
2226+ iRet = encoder_->EncodeFrame (&EncPic, &info);
2227+ ASSERT_TRUE (iRet == cmResultSuccess) << "rv = " << iRet;
2228+ if (iFrameNum == 5) {
2229+ sParam.iTemporalLayerNum = 3;
2230+ sParam.iTargetBitrate = 1500000;
2231+ sParam.sSpatialLayers[0].iSpatialBitrate = 1500000;
2232+ sParam.fMaxFrameRate = 30;
2233+ //sSvcParam.sSpatialLayers[0].fFrameRate = 30;
2234+ encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam);
2235+ } else if (iFrameNum == 10) {
2236+ sParam.iTemporalLayerNum = 1;
2237+ sParam.iTargetBitrate = 500000;
2238+ sParam.sSpatialLayers[0].iSpatialBitrate = 500000;
2239+ sParam.fMaxFrameRate = 7.5;
2240+ //sSvcParam.sSpatialLayers[0].fFrameRate = 7.5;
2241+ encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam);
2242+ } else if (iFrameNum == 15) {
2243+ sParam.iTemporalLayerNum = 2;
2244+ sParam.iTargetBitrate = 1000000;
2245+ sParam.sSpatialLayers[0].iSpatialBitrate = 1000000;
2246+ sParam.fMaxFrameRate = 15;
2247+ //sSvcParam.sSpatialLayers[0].fFrameRate = 15;
2248+ encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam);
2249+ }
2250+
2251+
2252+ }
2253+ iFrameNum++;
2254+ } while (iFrameNum < iTotalFrame);
2255+
2256+ iRet = encoder_->Uninitialize();
2257+ ASSERT_TRUE (iRet == cmResultSuccess) << "rv = " << iRet;
2258+
2259+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t