Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 7 files). Show all
Unified · Split
| @@ -510,25 +510,8 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 509 unmodified lines | ||
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | const int32_t kiEncoderReturn = EncodeFrameInternal(kpSrcPic, pBsInfo); |
| 513 | − | |
| 514 | − switch (kiEncoderReturn) { | |
| 515 | − case ENC_RETURN_MEMALLOCERR: | |
| 516 | − WelsUninitEncoderExt (&m_pEncContext); | |
| 517 | − return cmMallocMemeError; | |
| 518 | − case ENC_RETURN_SUCCESS: | |
| 519 | − case ENC_RETURN_CORRECTED: | |
| 520 | − break;//continue processing | |
| 521 | − case ENC_RETURN_UNSUPPORTED_PARA: | |
| 522 | − return cmUnsupportedData; | |
| 523 | − break; | |
| 524 | − case ENC_RETURN_UNEXPECTED: | |
| 525 | − return cmUnkonwReason; | |
| 526 | − default: | |
| 527 | − WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from WelsEncoderEncodeExt()!\n", kiEncoderReturn); | |
| 528 | − return cmUnkonwReason; | |
| 529 | − } | |
| 530 | − | |
| 531 | − | |
| 513 | + if(kiEncoderReturn != cmResultSuccess) | |
| 514 | + return kiEncoderReturn; | |
| 532 | 515 | #ifdef REC_FRAME_COUNT |
| 533 | 516 | ++ m_uiCountFrameNum; |
| 534 | 517 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| @@ -544,47 +527,23 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 9 unmodified lines | ||
| 544 | 527 | |
| 545 | 528 | int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFrameBSInfo* pBsInfo) { |
| 546 | 529 | if (!(pSrcPic && m_pEncContext && m_bInitialFlag) ){ |
| 547 | − return videoFrameTypeInvalid; | |
| 530 | + return cmInitParaError; | |
| 548 | 531 | } |
| 549 | 532 | |
| 550 | − int32_t iFrameTypeReturned = 0; | |
| 551 | − int32_t iFrameType = videoFrameTypeInvalid; | |
| 552 | 533 | const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPic); |
| 553 | 534 | |
| 554 | 535 | if(kiEncoderReturn == ENC_RETURN_MEMALLOCERR) { |
| 555 | 536 | WelsUninitEncoderExt (&m_pEncContext); |
| 556 | − return videoFrameTypeInvalid; | |
| 537 | + return cmMallocMemeError; | |
| 557 | 538 | } |
| 558 | 539 | else if((kiEncoderReturn != ENC_RETURN_SUCCESS)&&(kiEncoderReturn == ENC_RETURN_CORRECTED)){ |
| 559 | 540 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n", kiEncoderReturn); |
| 560 | − return videoFrameTypeInvalid; | |
| 541 | + return cmUnkonwReason; | |
| 561 | 542 | } |
| 562 | 543 | |
| 563 | − iFrameTypeReturned = pBsInfo->eOutputFrameType; | |
| 564 | − switch (iFrameTypeReturned) { | |
| 565 | − case WELS_FRAME_TYPE_P: | |
| 566 | − iFrameType = videoFrameTypeP; | |
| 567 | − break; | |
| 568 | − case WELS_FRAME_TYPE_IDR: | |
| 569 | − iFrameType = videoFrameTypeIDR; | |
| 570 | − break; | |
| 571 | − case WELS_FRAME_TYPE_SKIP: | |
| 572 | − iFrameType = videoFrameTypeSkip; | |
| 573 | − break; | |
| 574 | − case WELS_FRAME_TYPE_I: | |
| 575 | − iFrameType = videoFrameTypeI; | |
| 576 | − break; | |
| 577 | − case WELS_FRAME_TYPE_AUTO: | |
| 578 | − case WELS_FRAME_TYPE_B: // not support B pictures | |
| 579 | − iFrameType = videoFrameTypeInvalid; | |
| 580 | − break; | |
| 581 | − default: | |
| 582 | − break; | |
| 583 | − } | |
| 584 | − pBsInfo->eOutputFrameType = iFrameType; | |
| 585 | 544 | ///////////////////for test |
| 586 | 545 | #ifdef OUTPUT_BIT_STREAM |
| 587 | − if (iFrameType != videoFrameTypeInvalid && iFrameType != videoFrameTypeSkip) { | |
| 546 | + if (pBsInfo->eOutputFrameType != videoFrameTypeInvalid && pBsInfo->eOutputFrameType != videoFrameTypeSkip) { | |
| 588 | 547 | SLayerBSInfo* pLayer = NULL; |
| 589 | 548 | int32_t i = 0, j = 0, iCurLayerBits = 0, total_bits = 0; |
| 590 | 549 | |
| @@ -629,7 +588,7 @@ int CWelsH264SVCEncoder::EncodeFrameInternal(const SSourcePicture* pSrcPic, SFr · 38 unmodified lines | ||
| 629 | 588 | DumpSrcPicture (pSrcPicList[0]->pData[0]); |
| 630 | 589 | #endif // DUMP_SRC_PICTURE |
| 631 | 590 | |
| 632 | − return kiEncoderReturn; | |
| 591 | + return cmResultSuccess; | |
| 633 | 592 | |
| 634 | 593 | } |
| 635 | 594 | |