History

fix error judgment on return value in pauseframe

ruil2 committed 12 years ago

Commit ffb38321 parent 863ec741 file · +22 −16Browse files

Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 1 file). Show all

Unified · Split

codec/encoder/plus/src/welsEncoderExt.cpp+22−16
@@ -458,7 +458,8 @@ int CWelsH264SVCEncoder::EncodeFrameInternal (const SSourcePicture* pSrcPic, SF · 457 unmodified lines
458 WelsUninitEncoderExt (&m_pEncContext);458 WelsUninitEncoderExt (&m_pEncContext);
459 return cmMallocMemeError;459 return cmMallocMemeError;
460 } else if ((kiEncoderReturn != ENC_RETURN_SUCCESS) && (kiEncoderReturn == ENC_RETURN_CORRECTED)) {460 } else if ((kiEncoderReturn != ENC_RETURN_SUCCESS) && (kiEncoderReturn == ENC_RETURN_CORRECTED)) {
461 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n", kiEncoderReturn);461 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "unexpected return(%d) from EncodeFrameInternal()!\n",
462 kiEncoderReturn);
462 return cmUnkonwReason;463 return cmUnkonwReason;
463 }464 }
464 ///////////////////for test465 ///////////////////for test
@@ -520,15 +521,11 @@ int CWelsH264SVCEncoder::EncodeParameterSets (SFrameBSInfo* pBsInfo) { · 55 unmodified lines
520 * return: 0 - success; otherwise - failed;521 * return: 0 - success; otherwise - failed;
521 */522 */
522int CWelsH264SVCEncoder::PauseFrame (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo) {523int CWelsH264SVCEncoder::PauseFrame (const SSourcePicture* kpSrcPic, SFrameBSInfo* pBsInfo) {
523 int32_t iReturn = 1;524 int32_t iReturn = cmResultSuccess;
524 525
525 ForceIntraFrame (true);526 ForceIntraFrame (true);
526 527
527 if (EncodeFrameInternal (kpSrcPic, pBsInfo) != videoFrameTypeInvalid) {528 iReturn = EncodeFrameInternal (kpSrcPic, pBsInfo);
528 iReturn = 0;
529 }
530
531
532 // to avoid pause frame bitstream and529 // to avoid pause frame bitstream and
533 // normal bitstream use different video channel.530 // normal bitstream use different video channel.
534 ForceIntraFrame (true);531 ForceIntraFrame (true);
@@ -560,12 +557,14 @@ void CWelsH264SVCEncoder::CheckProfileSetting (int32_t iLayer, EProfileIdc uiPro · 25 unmodified lines
560 pLayerInfo->uiProfileIdc = uiProfileIdc;557 pLayerInfo->uiProfileIdc = uiProfileIdc;
561 if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {558 if ((iLayer == SPATIAL_LAYER_0) && (uiProfileIdc != PRO_BASELINE)) {
562 pLayerInfo->uiProfileIdc = PRO_BASELINE;559 pLayerInfo->uiProfileIdc = PRO_BASELINE;
563 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile\n", uiProfileIdc);560 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile\n",
561 uiProfileIdc);
564 }562 }
565 if (iLayer > SPATIAL_LAYER_0) {563 if (iLayer > SPATIAL_LAYER_0) {
566 if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {564 if ((uiProfileIdc != PRO_BASELINE) || (uiProfileIdc != PRO_SCALABLE_BASELINE)) {
567 pLayerInfo->uiProfileIdc = PRO_BASELINE;565 pLayerInfo->uiProfileIdc = PRO_BASELINE;
568 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile\n", uiProfileIdc);566 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "doesn't support profile(%d),change to baseline profile\n",
567 uiProfileIdc);
569 }568 }
570 }569 }
571}570}
@@ -600,7 +599,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 28 unmodified lines
600 599
601 switch (eOptionId) {600 switch (eOptionId) {
602 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag601 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
603 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.\n");602 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
603 "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.\n");
604 }604 }
605 break;605 break;
606 case ENCODER_OPTION_DATAFORMAT: { // Input color space606 case ENCODER_OPTION_DATAFORMAT: { // Input color space
@@ -650,7 +650,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 43 unmodified lines
650 int32_t iTargetHeight = 0;650 int32_t iTargetHeight = 0;
651 651
652 memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage652 memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage
653 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, sEncodingParam.iInputCsp= 0x%x\n",653 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
654 "ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, sEncodingParam.iInputCsp= 0x%x\n",
654 sEncodingParam.iInputCsp);655 sEncodingParam.iInputCsp);
655 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,656 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
656 "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d; coding_param->iMaxBitrate= %d; coding_param->iRCMode= %d;coding_param->iPaddingFlag= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;coding_param->iInputCsp= %d;coding_param->uiIntraPeriod= %d;coding_param->bEnableSpsPpsIdAddition = %d;coding_param->bPrefixNalAddingCtrl = %d;coding_param->bEnableDenoise= %d;coding_param->bEnableBackgroundDetection= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;\n",657 "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d; coding_param->iMaxBitrate= %d; coding_param->iRCMode= %d;coding_param->iPaddingFlag= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;coding_param->iInputCsp= %d;coding_param->uiIntraPeriod= %d;coding_param->bEnableSpsPpsIdAddition = %d;coding_param->bPrefixNalAddingCtrl = %d;coding_param->bEnableDenoise= %d;coding_param->bEnableBackgroundDetection= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;\n",
@@ -754,7 +755,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 97 unmodified lines
754 m_uiCountFrameNum, m_iCspInternal, iValue);755 m_uiCountFrameNum, m_iCspInternal, iValue);
755#endif//REC_FRAME_COUNT756#endif//REC_FRAME_COUNT
756 if (iBitrate <= 0) {757 if (iBitrate <= 0) {
757 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iBitrate = %d\n",758 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
759 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iBitrate = %d\n",
758 iBitrate);760 iBitrate);
759 return cmInitParaError;761 return cmInitParaError;
760 }762 }
@@ -776,7 +778,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 15 unmodified lines
776 m_pEncContext->pSvcParam->sSpatialLayers[3].iSpatialBitrate = iBitrate;778 m_pEncContext->pSvcParam->sSpatialLayers[3].iSpatialBitrate = iBitrate;
777 break;779 break;
778 default:780 default:
779 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d\n",781 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
782 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d\n",
780 pInfo->iLayer);783 pInfo->iLayer);
781 return cmInitParaError;784 return cmInitParaError;
782 break;785 break;
@@ -795,7 +798,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 12 unmodified lines
795 m_uiCountFrameNum, m_iCspInternal, iValue);798 m_uiCountFrameNum, m_iCspInternal, iValue);
796#endif//REC_FRAME_COUNT799#endif//REC_FRAME_COUNT
797 if (iBitrate <= 0) {800 if (iBitrate <= 0) {
798 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iBitrate = %d\n",801 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
802 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iBitrate = %d\n",
799 iBitrate);803 iBitrate);
800 return cmInitParaError;804 return cmInitParaError;
801 }805 }
@@ -817,7 +821,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 15 unmodified lines
817 m_pEncContext->pSvcParam->sSpatialLayers[3].iMaxSpatialBitrate = iBitrate;821 m_pEncContext->pSvcParam->sSpatialLayers[3].iMaxSpatialBitrate = iBitrate;
818 break;822 break;
819 default:823 default:
820 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iLayer = %d\n",824 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR,
825 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_MAX_BITRATE,iLayer = %d\n",
821 pInfo->iLayer);826 pInfo->iLayer);
822 return cmInitParaError;827 return cmInitParaError;
823 break;828 break;
@@ -965,7 +970,8 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) { · 141 unmodified lines
965 970
966 switch (eOptionId) {971 switch (eOptionId) {
967 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag972 case ENCODER_OPTION_INTER_SPATIAL_PRED: { // Inter spatial layer prediction flag
968 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.\n");973 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
974 "ENCODER_OPTION_INTER_SPATIAL_PRED, this feature not supported at present.\n");
969 }975 }
970 break;976 break;
971 case ENCODER_OPTION_DATAFORMAT: { // Input color space977 case ENCODER_OPTION_DATAFORMAT: { // Input color space

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t