define DEBUG_FILE_SAVE_CRA
| 598 | |
| 599 | //#define DEBUG_FILE_SAVE_CRA |
| 600 | TEST_F (DecodeCrashTestAPI, DecoderCrashTest) { |
| 601 | uint32_t uiGet; |
| 602 | encoder_->Uninitialize(); |
| 603 | |
| 604 | //do tests until crash |
| 605 | unsigned int uiLoopRound = 0; |
| 606 | unsigned char* pucBuf = ucBuf_; |
| 607 | int iDecAuSize; |
| 608 | #ifdef DEBUG_FILE_SAVE_CRA |
| 609 | //open file to save tested BS |
| 610 | FILE* fDataFile = fopen ("test_crash.264", "wb"); |
| 611 | FILE* fLenFile = fopen ("test_crash_len.log", "w"); |
| 612 | int iFileSize = 0; |
| 613 | #endif |
| 614 | |
| 615 | //set eCurStrategy for one test |
| 616 | EParameterSetStrategy eCurStrategy = CONSTANT_ID; |
| 617 | switch (rand() % 7) { |
| 618 | case 1: |
| 619 | eCurStrategy = INCREASING_ID; |
| 620 | break; |
| 621 | case 2: |
| 622 | eCurStrategy = SPS_LISTING; |
| 623 | break; |
| 624 | case 3: |
| 625 | eCurStrategy = SPS_LISTING_AND_PPS_INCREASING; |
| 626 | break; |
| 627 | case 6: |
| 628 | eCurStrategy = SPS_PPS_LISTING; |
| 629 | break; |
| 630 | default: |
| 631 | //using the initial value |
| 632 | break; |
| 633 | } |
| 634 | |
| 635 | do { |
| 636 | int iTotalFrameNum = (rand() % 100) + 1; |
| 637 | int iSeed = rand() % NUM_OF_POSSIBLE_RESOLUTION; |
| 638 | EncodeDecodeParamBase p = kParamArray[iSeed]; |
| 639 | #ifdef DEBUG_FILE_SAVE_CRA |
| 640 | printf ("using param set %d in loop %d\n", iSeed, uiLoopRound); |
| 641 | #endif |
| 642 | //Initialize Encoder |
| 643 | prepareParam (1, 1, p.width, p.height, p.frameRate, ¶m_); |
| 644 | param_.iRCMode = RC_TIMESTAMP_MODE; |
| 645 | param_.iTargetBitrate = p.iTarBitrate; |
| 646 | param_.uiIntraPeriod = 0; |
| 647 | param_.eSpsPpsIdStrategy = eCurStrategy; |
| 648 | param_.bEnableBackgroundDetection = true; |
| 649 | param_.bEnableSceneChangeDetect = (rand() % 3) ? true : false; |
| 650 | param_.bPrefixNalAddingCtrl = (rand() % 2) ? true : false; |
| 651 | param_.iEntropyCodingModeFlag = 0; |
| 652 | param_.bEnableFrameSkip = true; |
| 653 | param_.iMultipleThreadIdc = 0; |
| 654 | param_.sSpatialLayers[0].iSpatialBitrate = p.iTarBitrate; |
| 655 | param_.sSpatialLayers[0].iMaxSpatialBitrate = p.iTarBitrate << 1; |
| 656 | param_.sSpatialLayers[0].sSliceArgument.uiSliceMode = (rand() % 2) ? SM_SIZELIMITED_SLICE : SM_SINGLE_SLICE; |
| 657 | if (param_.sSpatialLayers[0].sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE) { |
nothing calls this directly
no test coverage detected