WelsErrorType  CWelsTaskManageBase::ExecuteTasks() {
  m_iWaitTaskNum = static_cast<int32_t> (m_cTaskList->size());
  while (NULL != m_cTaskList->begin()) {
    m_pThreadPool->QueueTask (m_cTaskList->begin());
    m_cTaskList->pop_front();
  }
  WelsEventWait (&m_hTaskEvent);

  return ENC_RETURN_SUCCESS;
}
//TODO: at present there is no diff betweenCWelsTaskManageParallel and CWelsTaskManageBase, to finish later
WelsErrorType  CWelsTaskManageParallel::ExecuteTasks() {
  WELS_VERIFY_RETURN_IF (ENC_RETURN_MEMALLOCERR, NULL == m_pThreadPool)

  // need lock here?
  m_iWaitTaskNum = static_cast<int32_t> (m_cTaskList->size());

  while (NULL != m_cTaskList->begin()) {
    m_pThreadPool->QueueTask (m_cTaskList->begin());
    m_cTaskList->pop_front();
  }
  WelsEventWait (&m_hTaskEvent);

  return ENC_RETURN_SUCCESS;
}
WelsErrorType  CWelsTaskManageBase::ExecuteTaskList (TASKLIST_TYPE* pTargetTaskList) {
  m_iWaitTaskNum = m_iCurrentTaskNum;
  //printf ("ExecuteTaskList m_iWaitTaskNum=%d\n", m_iWaitTaskNum);
  if (0 == m_iWaitTaskNum) {
    return ENC_RETURN_SUCCESS;
  }

  int32_t iCurrentTaskCount = m_iWaitTaskNum; //if directly use m_iWaitTaskNum in the loop make cause sync problem
  int32_t iIdx = 0;
  while (iIdx < iCurrentTaskCount) {
    m_pThreadPool->QueueTask (pTargetTaskList->GetIndexNode (iIdx));
    iIdx ++;
  }
  WelsEventWait (&m_hTaskEvent);

  return ENC_RETURN_SUCCESS;
}