shithub: openh264

Download patch

ref: 3c085aec794307fa4bdc78637a5cdfc1e3cdf398
parent: 9b442b3d44bbb2afcdf0bea6e75191d4bacc8982
author: Sijia Chen <[email protected]>
date: Fri Jan 30 10:43:20 EST 2015

improve error logging in UT

--- a/test/encoder/EncUT_EncoderExt.cpp
+++ b/test/encoder/EncUT_EncoderExt.cpp
@@ -487,13 +487,9 @@
   GetValidEncParamBase (&sEncParamBase);
 
   int iResult = pPtrEnc->Initialize (&sEncParamBase);
-  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  if (iResult != cmResultSuccess) {
-    fprintf (stderr, "Unexpected ParamBase? \
-             iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n",
-             sEncParamBase.iUsageType, sEncParamBase.iPicWidth, sEncParamBase.iPicHeight,
-             sEncParamBase.iTargetBitrate, sEncParamBase.iRCMode, sEncParamBase.fMaxFrameRate);
-  }
+  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)) << "iUsageType = " << sEncParamBase.iUsageType <<
+      ", iPicWidth = " << sEncParamBase.iPicWidth << ", iPicHeight = " << sEncParamBase.iPicHeight << ", iTargetBitrate = " <<
+      sEncParamBase.iTargetBitrate << ", fMaxFrameRate = " << sEncParamBase.fMaxFrameRate;
 
   PrepareOneSrcFrame();
 
@@ -510,13 +506,9 @@
   GetValidEncParamBase (&sEncParamBase);
 
   int iResult = pPtrEnc->Initialize (&sEncParamBase);
-  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  if (iResult != cmResultSuccess) {
-    fprintf (stderr, "Unexpected ParamBase? \
-                 iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n",
-             sEncParamBase.iUsageType, sEncParamBase.iPicWidth, sEncParamBase.iPicHeight,
-             sEncParamBase.iTargetBitrate, sEncParamBase.iRCMode, sEncParamBase.fMaxFrameRate);
-  }
+  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)) << "iUsageType = " << sEncParamBase.iUsageType <<
+      ", iPicWidth = " << sEncParamBase.iPicWidth << ", iPicHeight = " << sEncParamBase.iPicHeight << ", iTargetBitrate = " <<
+      sEncParamBase.iTargetBitrate << ", fMaxFrameRate = " << sEncParamBase.fMaxFrameRate;
 
   PrepareOneSrcFrame();
 
@@ -626,13 +618,9 @@
   GetValidEncParamBase (&sEncParamBase);
 
   int iResult = pPtrEnc->Initialize (&sEncParamBase);
-  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  if (iResult != cmResultSuccess) {
-    fprintf (stderr, "Unexpected ParamBase? \
-             iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n",
-             sEncParamBase.iUsageType, sEncParamBase.iPicWidth, sEncParamBase.iPicHeight,
-             sEncParamBase.iTargetBitrate, sEncParamBase.iRCMode, sEncParamBase.fMaxFrameRate);
-  }
+  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)) << "iUsageType = " << sEncParamBase.iUsageType <<
+      ", iPicWidth = " << sEncParamBase.iPicWidth << ", iPicHeight = " << sEncParamBase.iPicHeight << ", iTargetBitrate = " <<
+      sEncParamBase.iTargetBitrate << ", fMaxFrameRate = " << sEncParamBase.fMaxFrameRate;
 
   PrepareOneSrcFrame();
 
@@ -676,13 +664,9 @@
   sEncParamExt.iTemporalLayerNum = (iTargetTemporalLayerNum > 2) ? iTargetTemporalLayerNum : 2;
 
   int iResult = pPtrEnc->InitializeExt (&sEncParamExt);
-  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  if (iResult != cmResultSuccess) {
-    fprintf (stderr, "Unexpected ParamBase? \
-             iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n",
-             sEncParamExt.iUsageType, sEncParamExt.iPicWidth, sEncParamExt.iPicHeight,
-             sEncParamExt.iTargetBitrate, sEncParamExt.iRCMode, sEncParamExt.fMaxFrameRate);
-  }
+  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)) << "iUsageType = " << sEncParamExt.iUsageType <<
+      ", iPicWidth = " << sEncParamExt.iPicWidth << ", iPicHeight = " << sEncParamExt.iPicHeight << ", iTargetBitrate = " <<
+      sEncParamExt.iTargetBitrate << ", fMaxFrameRate = " << sEncParamExt.fMaxFrameRate;
 
   PrepareOneSrcFrame();
 
@@ -708,13 +692,9 @@
   GetValidEncParamBase (&sEncParamBase);
 
   int iResult = pPtrEnc->Initialize (&sEncParamBase);
-  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  if (iResult != cmResultSuccess) {
-    fprintf (stderr, "Unexpected ParamBase? \
-             iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n",
-             sEncParamBase.iUsageType, sEncParamBase.iPicWidth, sEncParamBase.iPicHeight,
-             sEncParamBase.iTargetBitrate, sEncParamBase.iRCMode, sEncParamBase.fMaxFrameRate);
-  }
+  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)) << "iUsageType = " << sEncParamBase.iUsageType <<
+      ", iPicWidth = " << sEncParamBase.iPicWidth << ", iPicHeight = " << sEncParamBase.iPicHeight << ", iTargetBitrate = " <<
+      sEncParamBase.iTargetBitrate << ", fMaxFrameRate = " << sEncParamBase.fMaxFrameRate;
   PrepareOneSrcFrame();
   EncodeOneIDRandP (pPtrEnc);
 
@@ -797,13 +777,9 @@
   GetValidEncParamBase (&sEncParamBase);
 
   int iResult = pPtrEnc->Initialize (&sEncParamBase);
-  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  if (iResult != cmResultSuccess) {
-    fprintf (stderr, "Unexpected ParamBase? \
-             iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n",
-             sEncParamBase.iUsageType, sEncParamBase.iPicWidth, sEncParamBase.iPicHeight,
-             sEncParamBase.iTargetBitrate, sEncParamBase.iRCMode, sEncParamBase.fMaxFrameRate);
-  }
+  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)) << "iUsageType = " << sEncParamBase.iUsageType <<
+      ", iPicWidth = " << sEncParamBase.iPicWidth << ", iPicHeight = " << sEncParamBase.iPicHeight << ", iTargetBitrate = " <<
+      sEncParamBase.iTargetBitrate << ", fMaxFrameRate = " << sEncParamBase.fMaxFrameRate;
 
   PrepareOneSrcFrame();
   EncodeOneIDRandP (pPtrEnc);
@@ -864,13 +840,9 @@
   GetValidEncParamBase (&sEncParamBase);
 
   int iResult = pPtrEnc->Initialize (&sEncParamBase);
-  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  if (iResult != cmResultSuccess) {
-    fprintf (stderr, "Unexpected ParamBase? \
-             iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n",
-             sEncParamBase.iUsageType, sEncParamBase.iPicWidth, sEncParamBase.iPicHeight,
-             sEncParamBase.iTargetBitrate, sEncParamBase.iRCMode, sEncParamBase.fMaxFrameRate);
-  }
+  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)) << "iUsageType = " << sEncParamBase.iUsageType <<
+      ", iPicWidth = " << sEncParamBase.iPicWidth << ", iPicHeight = " << sEncParamBase.iPicHeight << ", iTargetBitrate = " <<
+      sEncParamBase.iTargetBitrate << ", fMaxFrameRate = " << sEncParamBase.fMaxFrameRate;
 
   PrepareOneSrcFrame();
   iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
@@ -921,13 +893,9 @@
   pParamExt->iPicHeight = sEncParamExt.sSpatialLayers[0].iVideoHeight;
 
   iResult = pPtrEnc->InitializeExt (&sEncParamExt);
-  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
-  if (iResult != cmResultSuccess) {
-    fprintf (stderr, "Unexpected sEncParamExt? \
-             iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n",
-             sEncParamExt.iUsageType, sEncParamExt.iPicWidth, sEncParamExt.iPicHeight,
-             sEncParamExt.iTargetBitrate, sEncParamExt.iRCMode, sEncParamExt.fMaxFrameRate);
-  }
+  EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)) << "iUsageType = " << sEncParamExt.iUsageType <<
+      ", iPicWidth = " << sEncParamExt.iPicWidth << ", iPicHeight = " << sEncParamExt.iPicHeight << ", iTargetBitrate = " <<
+      sEncParamExt.iTargetBitrate << ", fMaxFrameRate = " << sEncParamExt.fMaxFrameRate;
 
   int iInterval = 300;
   iResult = pPtrEnc->SetOption (ENCODER_OPTION_STATISTICS_LOG_INTERVAL, &iInterval);