Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 4 files). Show all
Unified · Split
| @@ -198,11 +198,7 @@ long CWelsDecoder::Initialize (const SDecodingParam* pParam) { · 197 unmodified lines | |||
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | // H.264 decoder initialization,including memory allocation,then open it ready to decode | 200 | // H.264 decoder initialization,including memory allocation,then open it ready to decode |
| 201 | iRet = InitDecoder (pParam->bParseOnly); | 201 | iRet = InitDecoder (pParam); |
| 202 | if (iRet) | ||
| 203 | return iRet; | ||
| 204 | |||
| 205 | iRet = DecoderConfigParam (m_pDecContext, pParam); | ||
| 206 | if (iRet) | 202 | if (iRet) |
| 207 | return iRet; | 203 | return iRet; |
| 208 | 204 | ||
| @@ -241,11 +237,11 @@ void CWelsDecoder::UninitDecoder (void) { · 32 unmodified lines | |||
| 241 | } | 237 | } |
| 242 | 238 | ||
| 243 | // the return value of this function is not suitable, it need report failure info to upper layer. | 239 | // the return value of this function is not suitable, it need report failure info to upper layer. |
| 244 | int32_t CWelsDecoder::InitDecoder (const bool bParseOnly) { | 240 | int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { |
| 245 | 241 | ||
| 246 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 242 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| 247 | "CWelsDecoder::init_decoder(), openh264 codec version = %s, ParseOnly = %d", | 243 | "CWelsDecoder::init_decoder(), openh264 codec version = %s, ParseOnly = %d", |
| 248 | VERSION_NUMBER, (int32_t)bParseOnly); | 244 | VERSION_NUMBER, (int32_t)pParam->bParseOnly); |
| 249 | 245 | ||
| 250 | if (m_pDecContext) //free | 246 | if (m_pDecContext) //free |
| 251 | UninitDecoder(); | 247 | UninitDecoder(); |
| @@ -256,7 +252,17 @@ int32_t CWelsDecoder::InitDecoder (const bool bParseOnly) { · 4 unmodified lines | |||
| 256 | m_pDecContext->pMemAlign = new CMemoryAlign (iCacheLineSize); | 252 | m_pDecContext->pMemAlign = new CMemoryAlign (iCacheLineSize); |
| 257 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == m_pDecContext->pMemAlign), UninitDecoder()) | 253 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == m_pDecContext->pMemAlign), UninitDecoder()) |
| 258 | 254 | ||
| 259 | return WelsInitDecoder (m_pDecContext, bParseOnly, &m_pWelsTrace->m_sLogCtx); | 255 | WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, WelsInitDecoder (m_pDecContext, pParam->bParseOnly, |
| 256 | &m_pWelsTrace->m_sLogCtx), UninitDecoder()) | ||
| 257 | |||
| 258 | //check param and update decoder context | ||
| 259 | m_pDecContext->pParam = (SDecodingParam*) m_pDecContext->pMemAlign->WelsMallocz (sizeof (SDecodingParam), | ||
| 260 | "SDecodingParam"); | ||
| 261 | WELS_VERIFY_RETURN_PROC_IF (cmMallocMemeError, (NULL == m_pDecContext->pParam), UninitDecoder()); | ||
| 262 | int32_t iRet = DecoderConfigParam (m_pDecContext, pParam); | ||
| 263 | WELS_VERIFY_RETURN_IFNEQ (iRet, cmResultSuccess); | ||
| 264 | |||
| 265 | return cmResultSuccess; | ||
| 260 | } | 266 | } |
| 261 | 267 | ||
| 262 | int32_t CWelsDecoder::ResetDecoder() { | 268 | int32_t CWelsDecoder::ResetDecoder() { |
| @@ -267,11 +273,7 @@ int32_t CWelsDecoder::ResetDecoder() { · 4 unmodified lines | |||
| 267 | SDecodingParam sPrevParam; | 273 | SDecodingParam sPrevParam; |
| 268 | memcpy (&sPrevParam, m_pDecContext->pParam, sizeof (SDecodingParam)); | 274 | memcpy (&sPrevParam, m_pDecContext->pParam, sizeof (SDecodingParam)); |
| 269 | 275 | ||
| 270 | int32_t iRet = InitDecoder (m_pDecContext->bParseOnly); | 276 | WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, InitDecoder (&sPrevParam), UninitDecoder()); |
| 271 | if (iRet) | ||
| 272 | return iRet; | ||
| 273 | |||
| 274 | return DecoderConfigParam (m_pDecContext, &sPrevParam); | ||
| 275 | } else if (m_pWelsTrace != NULL) { | 277 | } else if (m_pWelsTrace != NULL) { |
| 276 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "ResetDecoder() failed as decoder context null"); | 278 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "ResetDecoder() failed as decoder context null"); |
| 277 | } | 279 | } |