Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 4 files). Show all
Unified · Split
| @@ -942,19 +942,27 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 941 unmodified lines | |||
| 942 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_FRAME_RATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d\n", | 942 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_FRAME_RATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d\n", |
| 943 | m_uiCountFrameNum, m_iCspInternal, iValue); | 943 | m_uiCountFrameNum, m_iCspInternal, iValue); |
| 944 | #endif//REC_FRAME_COUNT | 944 | #endif//REC_FRAME_COUNT |
| 945 | m_pEncContext->pSvcParam->fMaxFrameRate = iValue; | 945 | if (iValue<=0) { |
| 946 | 946 | return cmInitParaError; | |
| 947 | } | ||
| 948 | //adjust to valid range | ||
| 949 | m_pEncContext->pSvcParam->fMaxFrameRate = WELS_CLIP3 (iValue, MIN_FRAME_RATE, MAX_FRAME_RATE); | ||
| 950 | WelsEncoderApplyFrameRate (m_pEncContext->pSvcParam); | ||
| 947 | } | 951 | } |
| 948 | break; | 952 | break; |
| 949 | case ENCODER_OPTION_BITRATE: { // Target bit-rate | 953 | case ENCODER_OPTION_BITRATE: { // Target bit-rate |
| 950 | int32_t iValue = * ((int32_t*)pOption); | 954 | int32_t iValue = * ((int32_t*)pOption); |
| 951 | #ifdef REC_FRAME_COUNT | 955 | #ifdef REC_FRAME_COUNT |
| 952 | WelsLog (m_pEncContext, WELS_LOG_INFO, | 956 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| 953 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d\n", | 957 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x, iValue= %d\n", |
| 954 | m_uiCountFrameNum, m_iCspInternal, iValue); | 958 | m_uiCountFrameNum, m_iCspInternal, iValue); |
| 955 | #endif//REC_FRAME_COUNT | 959 | #endif//REC_FRAME_COUNT |
| 956 | m_pEncContext->pSvcParam->iTargetBitrate = iValue; | 960 | if (iValue<=0) { |
| 957 | 961 | return cmInitParaError; | |
| 962 | } | ||
| 963 | //adjust to valid range | ||
| 964 | m_pEncContext->pSvcParam->iTargetBitrate = WELS_CLIP3 (iValue, MIN_BIT_RATE, MAX_BIT_RATE); | ||
| 965 | WelsEncoderApplyBitRate (m_pEncContext->pSvcParam); | ||
| 958 | } | 966 | } |
| 959 | break; | 967 | break; |
| 960 | case ENCODER_OPTION_RC_MODE: { // 0:quality mode;1:bit-rate mode | 968 | case ENCODER_OPTION_RC_MODE: { // 0:quality mode;1:bit-rate mode |