History

add error handling of task returns

sijchen committed 11 years ago

Commit 6fe05b01 parent b5d890c2 files · +14 −5Browse files

Showing the changes to codec/encoder/core/src/wels_task_encoder.cpp (1 of 2 files). Show all

Unified · Split

codec/encoder/core/src/wels_task_encoder.cpp+12−5
@@ -55,7 +55,7 @@ · 54 unmodified lines
55 55
56namespace WelsEnc {56namespace WelsEnc {
57 57
58CWelsSliceEncodingTask::CWelsSliceEncodingTask (sWelsEncCtx* pCtx, const int32_t iSliceIdx) {58CWelsSliceEncodingTask::CWelsSliceEncodingTask (sWelsEncCtx* pCtx, const int32_t iSliceIdx) : m_eTaskResult(ENC_RETURN_SUCCESS) {
59 m_pCtx = pCtx;59 m_pCtx = pCtx;
60 m_iSliceIdx = iSliceIdx;60 m_iSliceIdx = iSliceIdx;
61}61}
@@ -66,13 +66,13 @@ CWelsSliceEncodingTask::~CWelsSliceEncodingTask() { · 4 unmodified lines
66WelsErrorType CWelsSliceEncodingTask::Execute() {66WelsErrorType CWelsSliceEncodingTask::Execute() {
67 WelsThreadSetName ("OpenH264Enc_CWelsSliceEncodingTask_Execute");67 WelsThreadSetName ("OpenH264Enc_CWelsSliceEncodingTask_Execute");
68 68
69 int32_t iReturn = InitTask();69 m_eTaskResult = InitTask();
70 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)70 WELS_VERIFY_RETURN_IFNEQ (m_eTaskResult, ENC_RETURN_SUCCESS)
71 71
72 iReturn = ExecuteTask();72 m_eTaskResult = ExecuteTask();
73 73
74 FinishTask();74 FinishTask();
75 return ENC_RETURN_SUCCESS;75 return m_eTaskResult;
76}76}
77 77
78WelsErrorType CWelsSliceEncodingTask::SetBoundary (int32_t iStartIdx, int32_t iEndIdx) {78WelsErrorType CWelsSliceEncodingTask::SetBoundary (int32_t iStartIdx, int32_t iEndIdx) {
@@ -131,6 +131,13 @@ void CWelsSliceEncodingTask::FinishTask() { · 52 unmodified lines
131 WelsLog (&m_pCtx->sLogCtx, WELS_LOG_DEBUG,131 WelsLog (&m_pCtx->sLogCtx, WELS_LOG_DEBUG,
132 "[MT] CWelsSliceEncodingTask()FinishTask for m_iSliceIdx %d, unlock thread %d",132 "[MT] CWelsSliceEncodingTask()FinishTask for m_iSliceIdx %d, unlock thread %d",
133 m_iSliceIdx, m_iThreadIdx);133 m_iSliceIdx, m_iThreadIdx);
134
135 //sync multi-threading error
136 WelsMutexLock (&m_pCtx->mutexEncoderError);
137 if (ENC_RETURN_SUCCESS != m_eTaskResult) {
138 m_pCtx->iEncoderError |= m_eTaskResult;
139 }
140 WelsMutexUnlock (&m_pCtx->mutexEncoderError);
134}141}
135 142
136WelsErrorType CWelsSliceEncodingTask::ExecuteTask() {143WelsErrorType CWelsSliceEncodingTask::ExecuteTask() {

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