shithub: openh264

Download patch

ref: 2e85e3c7d98811f1fea4ea617a55b23813a428dd
parent: 5ff55a6ec245d7e8d0c01082d9c71aa0c83f83dc
author: lyao2 <[email protected]>
date: Thu Dec 11 09:32:26 EST 2014

refine the UT case for checking IDR request

--- a/test/encoder/EncUT_EncoderExt.cpp
+++ b/test/encoder/EncUT_EncoderExt.cpp
@@ -122,7 +122,7 @@
   int iResult;
   iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
   EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  //EXPECT_EQ (sFbi.eFrameType, static_cast<int> (videoFrameTypeIDR));
+  EXPECT_EQ (sFbi.eFrameType, static_cast<int> (videoFrameTypeIDR));
 
   pSrcPic->uiTimeStamp += 30;
   iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
@@ -619,7 +619,13 @@
 
   //call next frame to be IDR
   pPtrEnc->ForceIntraFrame (bIDR);
-  EncodeOneIDRandP (pPtrEnc);
+  int iCount = 0;
+  do {
+    iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
+    EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
+    pSrcPic->uiTimeStamp += 30;
+  } while ((sFbi.eFrameType == static_cast<int> (videoFrameTypeSkip)) && (iCount ++ < 100));
+  EXPECT_EQ (sFbi.eFrameType, static_cast<int> (videoFrameTypeIDR));
 
   pPtrEnc->Uninitialize();
   EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
@@ -659,7 +665,13 @@
 
   //call next frame to be IDR
   pPtrEnc->ForceIntraFrame (bIDR);
-  EncodeOneIDRandP (pPtrEnc);
+  int iCount = 0;
+  do {
+    iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
+    EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
+    pSrcPic->uiTimeStamp += 30;
+  } while ((sFbi.eFrameType == static_cast<int> (videoFrameTypeSkip)) && (iCount ++ < 100));
+  EXPECT_EQ (sFbi.eFrameType, static_cast<int> (videoFrameTypeIDR));
 
   pPtrEnc->Uninitialize();
   EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));