Showing the changes to test/decoder/DecUT_ParseSyntax.cpp (1 of 4 files). Show all
Unified · Split
| @@ -58,8 +58,23 @@ DECODING_STATE DecodeFrame (const unsigned char* kpSrc, · 57 unmodified lines | |||
| 58 | return dsErrorFree; | 58 | return dsErrorFree; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | void UninitDecoder (PWelsDecoderContext pCtx) { | ||
| 62 | if (NULL == pCtx) | ||
| 63 | return; | ||
| 64 | |||
| 65 | WelsEndDecoder (pCtx); | ||
| 66 | if (NULL != pCtx->pMemAlign) { | ||
| 67 | delete pCtx->pMemAlign; | ||
| 68 | pCtx->pMemAlign = NULL; | ||
| 69 | } | ||
| 70 | if (NULL != pCtx) { | ||
| 71 | free (pCtx); | ||
| 72 | pCtx = NULL; | ||
| 73 | } | ||
| 61 | 74 | ||
| 62 | int32_t InitDecoder (const bool bParseOnly, PWelsDecoderContext pCtx, SLogContext* pLogCtx) { | 75 | } |
| 76 | |||
| 77 | int32_t InitDecoder (const SDecodingParam* pParam, PWelsDecoderContext pCtx, SLogContext* pLogCtx) { | ||
| 63 | 78 | ||
| 64 | 79 | ||
| 65 | if (NULL == pCtx) | 80 | if (NULL == pCtx) |
| @@ -71,7 +86,14 @@ int32_t InitDecoder (const bool bParseOnly, PWelsDecoderContext pCtx, SLogContex · 5 unmodified lines | |||
| 71 | return cmMallocMemeError; | 86 | return cmMallocMemeError; |
| 72 | } | 87 | } |
| 73 | 88 | ||
| 74 | return WelsInitDecoder (pCtx, bParseOnly, pLogCtx); | 89 | WELS_VERIFY_RETURN_PROC_IF (cmInitParaError, WelsInitDecoder (pCtx, pParam->bParseOnly, pLogCtx), UninitDecoder (pCtx)); |
| 90 | //check param and update decoder context | ||
| 91 | pCtx->pParam = (SDecodingParam*) pCtx->pMemAlign->WelsMallocz (sizeof (SDecodingParam), "SDecodingParam"); | ||
| 92 | WELS_VERIFY_RETURN_PROC_IF (cmMallocMemeError, (NULL == pCtx->pParam), UninitDecoder (pCtx)); | ||
| 93 | int32_t iRet = DecoderConfigParam (pCtx, pCtx->pParam); | ||
| 94 | WELS_VERIFY_RETURN_IFNEQ (iRet, cmResultSuccess); | ||
| 95 | |||
| 96 | return cmResultSuccess; | ||
| 75 | } | 97 | } |
| 76 | 98 | ||
| 77 | long Initialize (const SDecodingParam* pParam, PWelsDecoderContext pCtx, SLogContext* pLogCtx) { | 99 | long Initialize (const SDecodingParam* pParam, PWelsDecoderContext pCtx, SLogContext* pLogCtx) { |
| @@ -81,32 +103,13 @@ long Initialize (const SDecodingParam* pParam, PWelsDecoderContext pCtx, SLogCon · 3 unmodified lines | |||
| 81 | } | 103 | } |
| 82 | 104 | ||
| 83 | // H.264 decoder initialization,including memory allocation,then open it ready to decode | 105 | // H.264 decoder initialization,including memory allocation,then open it ready to decode |
| 84 | iRet = InitDecoder (pParam->bParseOnly, pCtx, pLogCtx); | 106 | iRet = InitDecoder (pParam, pCtx, pLogCtx); |
| 85 | if (iRet) | ||
| 86 | return iRet; | ||
| 87 | |||
| 88 | iRet = DecoderConfigParam (pCtx, pParam); | ||
| 89 | if (iRet) | 107 | if (iRet) |
| 90 | return iRet; | 108 | return iRet; |
| 91 | 109 | ||
| 92 | return cmResultSuccess; | 110 | return cmResultSuccess; |
| 93 | } | 111 | } |
| 94 | 112 | ||
| 95 | void UninitDecoder (PWelsDecoderContext pCtx) { | ||
| 96 | if (NULL == pCtx) | ||
| 97 | return; | ||
| 98 | |||
| 99 | WelsEndDecoder (pCtx); | ||
| 100 | if (NULL != pCtx->pMemAlign) { | ||
| 101 | delete pCtx->pMemAlign; | ||
| 102 | pCtx->pMemAlign = NULL; | ||
| 103 | } | ||
| 104 | if (NULL != pCtx) { | ||
| 105 | free (pCtx); | ||
| 106 | pCtx = NULL; | ||
| 107 | } | ||
| 108 | |||
| 109 | } | ||
| 110 | class DecoderParseSyntaxTest : public ::testing::Test { | 113 | class DecoderParseSyntaxTest : public ::testing::Test { |
| 111 | public: | 114 | public: |
| 112 | virtual void SetUp() { | 115 | virtual void SetUp() { |