Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 16 files). Show all
Unified · Split
| @@ -521,22 +521,32 @@ int CWelsH264SVCEncoder::EncodeFrame (const SSourcePicture* kpSrcPic, SFrameBSIn · 520 unmodified lines | |||
| 521 | 521 | ||
| 522 | 522 | ||
| 523 | int CWelsH264SVCEncoder::EncodeFrame2 (const SSourcePicture** pSrcPicList, int nSrcPicNum, SFrameBSInfo* pBsInfo) { | 523 | int CWelsH264SVCEncoder::EncodeFrame2 (const SSourcePicture** pSrcPicList, int nSrcPicNum, SFrameBSInfo* pBsInfo) { |
| 524 | if (! (pSrcPicList && m_pEncContext && m_bInitialFlag)) { | 524 | if (!(pSrcPicList && m_pEncContext && m_bInitialFlag) || (nSrcPicNum<=0) ){ |
| 525 | return videoFrameTypeInvalid; | 525 | return videoFrameTypeInvalid; |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | int32_t iFrameTypeReturned = 0; | 528 | int32_t iFrameTypeReturned = 0; |
| 529 | int32_t iFrameType = videoFrameTypeInvalid; | 529 | int32_t iFrameType = videoFrameTypeInvalid; |
| 530 | XMMREG_PROTECT_STORE(CWelsH264SVCEncoder); | ||
| 531 | const int32_t kiEncoderReturn = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPicList, nSrcPicNum); | ||
| 532 | XMMREG_PROTECT_LOAD(CWelsH264SVCEncoder); | ||
| 530 | 533 | ||
| 531 | if (nSrcPicNum > 0) { | 534 | switch (kiEncoderReturn) { |
| 532 | XMMREG_PROTECT_STORE(CWelsH264SVCEncoder); | 535 | case ENC_RETURN_MEMALLOCERR: |
| 533 | iFrameTypeReturned = WelsEncoderEncodeExt (m_pEncContext, pBsInfo, pSrcPicList, nSrcPicNum); | 536 | WelsUninitEncoderExt (&m_pEncContext); |
| 534 | XMMREG_PROTECT_LOAD(CWelsH264SVCEncoder); | 537 | return videoFrameTypeInvalid; |
| 535 | } else { | 538 | case ENC_RETURN_SUCCESS: |
| 536 | assert (0); | 539 | case ENC_RETURN_CORRECTED: |
| 540 | break;//continue processing | ||
| 541 | case ENC_RETURN_UNSUPPORTED_PARA: | ||
| 542 | case ENC_RETURN_UNEXPECTED: | ||
| 543 | return videoFrameTypeInvalid; | ||
| 544 | default: | ||
| 545 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "unexpected return(%d) from WelsEncoderEncodeExt()!\n", kiEncoderReturn); | ||
| 537 | return videoFrameTypeInvalid; | 546 | return videoFrameTypeInvalid; |
| 538 | } | 547 | } |
| 539 | 548 | ||
| 549 | iFrameTypeReturned = pBsInfo->eOutputFrameType; | ||
| 540 | switch (iFrameTypeReturned) { | 550 | switch (iFrameTypeReturned) { |
| 541 | case WELS_FRAME_TYPE_P: | 551 | case WELS_FRAME_TYPE_P: |
| 542 | iFrameType = videoFrameTypeP; | 552 | iFrameType = videoFrameTypeP; |
| @@ -832,7 +842,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 289 unmodified lines | |||
| 832 | return cmInitParaError; | 842 | return cmInitParaError; |
| 833 | } | 843 | } |
| 834 | //adjust to valid range | 844 | //adjust to valid range |
| 835 | m_pEncContext->pSvcParam->fMaxFrameRate = WELS_CLIP3 (iValue, MIN_FRAME_RATE, MAX_FRAME_RATE); | 845 | m_pEncContext->pSvcParam->fMaxFrameRate = WELS_CLIP3 (iValue, MIN_FRAME_RATE, MAX_FRAME_RATE); |
| 836 | WelsEncoderApplyFrameRate (m_pEncContext->pSvcParam); | 846 | WelsEncoderApplyFrameRate (m_pEncContext->pSvcParam); |
| 837 | } | 847 | } |
| 838 | break; | 848 | break; |