From 50277780fcfb4871d3ddbbbc7576a33698a9cc7c Mon Sep 17 00:00:00 2001 From: ChenHengming Date: Thu, 19 May 2016 06:35:22 +0000 Subject: [PATCH] [mpp_thread]: fix compile error on windows and linux git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@774 6e48237b-75ef-9749-8fc9-41990f28c85a --- mpp/mpp.cpp | 10 ++++------ osal/inc/mpp_thread.h | 5 +++++ osal/mpp_thread.cpp | 11 +++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mpp/mpp.cpp b/mpp/mpp.cpp index 907edd10..6333b91a 100644 --- a/mpp/mpp.cpp +++ b/mpp/mpp.cpp @@ -84,10 +84,8 @@ MPP_RET Mpp::init(MppCtxType type, MppCodingType coding) mDec->mpp = this; mpp_dec_init(mDec, coding); - mThreadCodec = new MppThread(mpp_dec_parser_thread, this); - mpp_log("mThreadCodec = %p", mThreadCodec); - mThreadHal = new MppThread(mpp_dec_hal_thread, this); - mpp_log("mThreadHal = %p", mThreadHal); + mThreadCodec = new MppThread(mpp_dec_parser_thread, this, "mpp_dec_parser"); + mThreadHal = new MppThread(mpp_dec_hal_thread, this, "mpp_dec_hal"); mpp_buffer_group_get_internal(&mInternalGroup, MPP_BUFFER_TYPE_ION); mpp_buffer_group_get_internal(&mPacketGroup, MPP_BUFFER_TYPE_ION); @@ -100,8 +98,8 @@ MPP_RET Mpp::init(MppCtxType type, MppCodingType coding) mTasks = new mpp_list((node_destructor)NULL); mpp_enc_init(&mEnc, coding); - mThreadCodec = new MppThread(mpp_enc_control_thread, this); - mThreadHal = new MppThread(mpp_enc_hal_thread, this); + mThreadCodec = new MppThread(mpp_enc_control_thread, this, "mpp_enc_ctrl"); + mThreadHal = new MppThread(mpp_enc_hal_thread, this, "mpp_enc_hal"); mpp_buffer_group_get_internal(&mInternalGroup, MPP_BUFFER_TYPE_ION); mpp_buffer_group_get_internal(&mPacketGroup, MPP_BUFFER_TYPE_NORMAL); diff --git a/osal/inc/mpp_thread.h b/osal/inc/mpp_thread.h index 025ffad8..340738c4 100644 --- a/osal/inc/mpp_thread.h +++ b/osal/inc/mpp_thread.h @@ -34,6 +34,11 @@ #include "pthread.h" #pragma comment(lib, "pthreadVC2.lib") +/* + * add pthread_setname_np for windows + */ +int pthread_setname_np(pthread_t thread, const char *name); + #else #include diff --git a/osal/mpp_thread.cpp b/osal/mpp_thread.cpp index 7c11e8b0..6f8e778d 100644 --- a/osal/mpp_thread.cpp +++ b/osal/mpp_thread.cpp @@ -19,6 +19,7 @@ #include #include "mpp_log.h" +#include "mpp_common.h" #include "mpp_thread.h" #define MPP_THREAD_DBG_FUNCTION (0x00000001) @@ -86,3 +87,13 @@ void MppThread::stop() } } +#if defined(_WIN32) && !defined(__MINGW32CE__) +/* + * add pthread_setname_np for windows + */ +int pthread_setname_np(pthread_t thread, const char *name) +{ + return 0; +} +#endif +