Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 11 files). Show all
Unified · Split
| @@ -243,6 +243,7 @@ int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { · 242 unmodified lines | ||
| 243 | 243 | "CWelsDecoder::init_decoder(), openh264 codec version = %s, ParseOnly = %d", |
| 244 | 244 | VERSION_NUMBER, (int32_t)pParam->bParseOnly); |
| 245 | 245 | |
| 246 | + //reset decoder context | |
| 246 | 247 | if (m_pDecContext) //free |
| 247 | 248 | UninitDecoder(); |
| 248 | 249 | m_pDecContext = (PWelsDecoderContext)WelsMallocz (sizeof (SWelsDecoderContext), "m_pDecContext"); |
| @@ -252,8 +253,8 @@ int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { · 3 unmodified lines | ||
| 252 | 253 | m_pDecContext->pMemAlign = new CMemoryAlign (iCacheLineSize); |
| 253 | 254 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == m_pDecContext->pMemAlign), UninitDecoder()) |
| 254 | 255 | |
| 255 | − WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, WelsInitDecoder (m_pDecContext, pParam->bParseOnly, | |
| 256 | − &m_pWelsTrace->m_sLogCtx), UninitDecoder()) | |
| 256 | + //fill in default value into context | |
| 257 | + WelsDecoderDefaults (m_pDecContext, &m_pWelsTrace->m_sLogCtx); | |
| 257 | 258 | |
| 258 | 259 | //check param and update decoder context |
| 259 | 260 | m_pDecContext->pParam = (SDecodingParam*) m_pDecContext->pMemAlign->WelsMallocz (sizeof (SDecodingParam), |
| @@ -262,6 +263,9 @@ int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { · 2 unmodified lines | ||
| 262 | 263 | int32_t iRet = DecoderConfigParam (m_pDecContext, pParam); |
| 263 | 264 | WELS_VERIFY_RETURN_IFNEQ (iRet, cmResultSuccess); |
| 264 | 265 | |
| 266 | + //init decoder | |
| 267 | + WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx), UninitDecoder()) | |
| 268 | + | |
| 265 | 269 | return cmResultSuccess; |
| 266 | 270 | } |
| 267 | 271 | |
| @@ -304,7 +308,7 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) { · 36 unmodified lines | ||
| 304 | 308 | |
| 305 | 309 | iVal = * ((int*)pOption); // int value for error concealment idc |
| 306 | 310 | iVal = WELS_CLIP3 (iVal, (int32_t) ERROR_CON_DISABLE, (int32_t) ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE); |
| 307 | − if ((m_pDecContext->bParseOnly) && (iVal != (int32_t) ERROR_CON_DISABLE)) { | |
| 311 | + if ((m_pDecContext->pParam->bParseOnly) && (iVal != (int32_t) ERROR_CON_DISABLE)) { | |
| 308 | 312 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| 309 | 313 | "CWelsDecoder::SetOption for ERROR_CON_IDC = %d not allowd for parse only!.", iVal); |
| 310 | 314 | return cmInitParaError; |
| @@ -438,7 +442,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 127 unmodified lines | ||
| 438 | 442 | const int kiSrcLen, |
| 439 | 443 | unsigned char** ppDst, |
| 440 | 444 | SBufferInfo* pDstInfo) { |
| 441 | − if (m_pDecContext->bParseOnly) { | |
| 445 | + if (m_pDecContext->pParam->bParseOnly) { | |
| 442 | 446 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be false for this API calling! \n"); |
| 443 | 447 | m_pDecContext->iErrorCode |= dsInvalidArgument; |
| 444 | 448 | return dsInvalidArgument; |
| @@ -583,7 +587,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 138 unmodified lines | ||
| 583 | 587 | DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc, |
| 584 | 588 | const int kiSrcLen, |
| 585 | 589 | SParserBsInfo* pDstInfo) { |
| 586 | − if (!m_pDecContext->bParseOnly) { | |
| 590 | + if (!m_pDecContext->pParam->bParseOnly) { | |
| 587 | 591 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "bParseOnly should be true for this API calling! \n"); |
| 588 | 592 | m_pDecContext->iErrorCode |= dsInvalidArgument; |
| 589 | 593 | return dsInvalidArgument; |