History

disable wrongly calling for parseonly related

huili2 committed 10 years ago

Commit 9fade101 parent 2d3071e2 files · +106 −11Browse files

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

Unified · Split

test/decoder/DecUT_DecExt.cpp+94−9
@@ -34,6 +34,8 @@ class DecoderInterfaceTest : public ::testing::Test { · 33 unmodified lines
3434 void DecoderBs (const char* sFileName);
3535 //Test Initialize/Uninitialize
3636 void TestInitUninit();
37+ //Test parse only API
38+ void TestParseOnlyAPI();
3739 //DECODER_OPTION_END_OF_STREAM
3840 void TestEndOfStream();
3941 //DECODER_OPTION_VCL_NAL
@@ -66,6 +68,7 @@ class DecoderInterfaceTest : public ::testing::Test { · 26 unmodified lines
6668 ISVCDecoder* m_pDec;
6769 SDecodingParam m_sDecParam;
6870 SBufferInfo m_sBufferInfo;
71+ SParserBsInfo m_sParserBsInfo;
6972 uint8_t* m_pData[3];
7073 unsigned char m_szBuffer[BUF_SIZE]; //for mocking packet
7174 int m_iBufLength; //record the valid data in m_szBuffer
@@ -74,6 +77,7 @@ class DecoderInterfaceTest : public ::testing::Test { · 2 unmodified lines
7477 //Init members
7578 void DecoderInterfaceTest::Init() {
7679 memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
80+ memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo));
7781 memset (&m_sDecParam, 0, sizeof (SDecodingParam));
7882 m_sDecParam.pFileNameRestructed = NULL;
7983 m_sDecParam.uiCpuLoad = rand() % 100;
@@ -96,6 +100,7 @@ void DecoderInterfaceTest::Uninit() { · 16 unmodified lines
96100 ASSERT_EQ (eRet, cmResultSuccess);
97101 }
98102 memset (&m_sDecParam, 0, sizeof (SDecodingParam));
103+ memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo));
99104 memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
100105 m_pData[0] = m_pData[1] = m_pData[2] = NULL;
101106 m_iBufLength = 0;
@@ -180,16 +185,15 @@ void DecoderInterfaceTest::MockPacketType (const EWelsNalUnitType eNalUnitType, · 78 unmodified lines
180185 default:
181186 m_szBuffer[m_iBufLength++] = 0; //NAL_UNIT_UNSPEC_0
182187 break;
183−
184− int iAddLength = iPacketLength - 5; //excluding 0001 and type
185− if (iAddLength > PAYLOAD_SIZE)
186− iAddLength = PAYLOAD_SIZE;
187− for (int i = 0; i < iAddLength; ++i) {
188− m_szBuffer[m_iBufLength++] = rand() % 256;
189− }
190− m_szBuffer[m_iBufLength++] = '\0';
191−
192188 }
189+ int iAddLength = iPacketLength - 5; //excluding 0001 and type
190+ if (iAddLength > PAYLOAD_SIZE)
191+ iAddLength = PAYLOAD_SIZE;
192+ for (int i = 0; i < iAddLength; ++i) {
193+ m_szBuffer[m_iBufLength++] = rand() % 256;
194+ }
195+ m_szBuffer[m_iBufLength++] = '\0';
196+
193197 }
194198
195199 //Test Initialize/Uninitialize
@@ -220,6 +224,87 @@ void DecoderInterfaceTest::TestInitUninit() { · 24 unmodified lines
220224 }
221225 }
222226
227+//Test parse only API
228+void DecoderInterfaceTest::TestParseOnlyAPI() {
229+ int iOutput;
230+ int iRet;
231+
232+ m_pData[0] = m_pData[1] = m_pData[2] = NULL;
233+ m_szBuffer[0] = m_szBuffer[1] = m_szBuffer[2] = 0;
234+ m_szBuffer[3] = 1;
235+ m_iBufLength = 4;
236+ MockPacketType (NAL_UNIT_SPS, 12);
237+
238+ m_pDec->Uninitialize();
239+
240+ //test 1: bParseOnly = true; eEcActiveIdc = 0,1
241+ for (int iNum = 0; iNum < 2; ++iNum) { //loop for EC
242+ memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
243+ memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo));
244+ memset (&m_sDecParam, 0, sizeof (SDecodingParam));
245+ m_sDecParam.pFileNameRestructed = NULL;
246+ m_sDecParam.uiCpuLoad = rand() % 100;
247+ m_sDecParam.uiTargetDqLayer = -1;
248+ m_sDecParam.bParseOnly = true;
249+ m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC) iNum;
250+ m_sDecParam.sVideoProperty.size = sizeof (SVideoProperty);
251+ m_sDecParam.sVideoProperty.eVideoBsType = (VIDEO_BITSTREAM_TYPE) (rand() % 3);
252+
253+ iRet = m_pDec->Initialize (&m_sDecParam);
254+ ASSERT_EQ (iRet, (int32_t) cmResultSuccess);
255+ iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
256+ EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
257+ EXPECT_EQ (iOutput, (int32_t) ERROR_CON_DISABLE); //should be 0
258+ //call DecodeParser(), correct call
259+ iRet = (int32_t) m_pDec->DecodeParser (m_szBuffer, m_iBufLength, &m_sParserBsInfo);
260+ EXPECT_EQ (iRet, (int32_t) dsNoParamSets);
261+ iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
262+ EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
263+ EXPECT_EQ (iOutput, (int32_t) ERROR_CON_DISABLE); //should be 0
264+ //call DecodeFrame2(), incorrect call
265+ iRet = (int32_t) m_pDec->DecodeFrame2 (m_szBuffer, m_iBufLength, m_pData, &m_sBufferInfo);
266+ EXPECT_EQ (iRet, (int32_t) dsInvalidArgument);
267+ iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
268+ EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
269+ EXPECT_EQ (iOutput, (int32_t) ERROR_CON_DISABLE); //should be 0
270+ m_pDec->Uninitialize();
271+ }
272+
273+ //test 2: bParseOnly = false; eEcActiveIdc = 0,1
274+ for (int iNum = 0; iNum < 2; ++iNum) { //loop for EC
275+ memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
276+ memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo));
277+ memset (&m_sDecParam, 0, sizeof (SDecodingParam));
278+ m_sDecParam.pFileNameRestructed = NULL;
279+ m_sDecParam.uiCpuLoad = rand() % 100;
280+ m_sDecParam.uiTargetDqLayer = -1;
281+ m_sDecParam.bParseOnly = false;
282+ m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC) iNum;
283+ m_sDecParam.sVideoProperty.size = sizeof (SVideoProperty);
284+ m_sDecParam.sVideoProperty.eVideoBsType = (VIDEO_BITSTREAM_TYPE) (rand() % 3);
285+
286+ iRet = m_pDec->Initialize (&m_sDecParam);
287+ ASSERT_EQ (iRet, (int32_t) cmResultSuccess);
288+ iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
289+ EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
290+ EXPECT_EQ (iOutput, iNum);
291+ //call DecodeParser(), incorrect call
292+ iRet = (int32_t) m_pDec->DecodeParser (m_szBuffer, m_iBufLength, &m_sParserBsInfo);
293+ EXPECT_EQ (iRet, (int32_t) dsInvalidArgument); //error call
294+ iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
295+ EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
296+ EXPECT_EQ (iOutput, iNum);
297+ //call DecodeFrame2(), correct call
298+ iRet = (int32_t) m_pDec->DecodeFrame2 (m_szBuffer, m_iBufLength, m_pData, &m_sBufferInfo);
299+ EXPECT_EQ (iRet, (int32_t) dsNoParamSets);
300+ iRet = m_pDec->GetOption (DECODER_OPTION_ERROR_CON_IDC, &iOutput);
301+ EXPECT_EQ (iRet, (int32_t) cmResultSuccess);
302+ EXPECT_EQ (iOutput, iNum);
303+ m_pDec->Uninitialize();
304+ }
305+
306+}
307+
223308 //DECODER_OPTION_END_OF_STREAM
224309 void DecoderInterfaceTest::TestEndOfStream() {
225310 int iTmp, iOut;

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