diff --git a/hal_av_pipeline.c b/hal_av_pipeline.c index 123d54e..fdaa2f6 100644 --- a/hal_av_pipeline.c +++ b/hal_av_pipeline.c @@ -39,6 +39,8 @@ synaptics_player_info gSocPlayerInfo[2]; pthread_t p_thread_decoder_statistics; pthread_mutex_t thread_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t main_mutex = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t pip_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t thread_cond = PTHREAD_COND_INITIALIZER; bool isDestroy = true; bool isStop = true; @@ -250,7 +252,13 @@ int AVP_Start(AVP_HANDLE player, AVP_PlayerConfig *config) { ALOGD("BTF|%s|%d|IN| player=%x, vcodec=%d, acodec=%d, pcr_pid=%d, video_pid=%d, audio_pid=%d \n", __FUNCTION__,__LINE__, player, config->video_codec, config->audio_codec, config->pcr_pid, config->video_pid, config->audio_pid); synaptics_player_info *socPlayerInfo = (synaptics_player_info *) player; - socPlayerInfo->playerConfig = *config; + socPlayerInfo->playerConfig = *config; + + if( socPlayerInfo->pip ){ + pthread_mutex_lock(&pip_mutex); + }else{ + pthread_mutex_lock(&main_mutex); + } // check decoder error socPlayerInfo->decoder_errors_num_adec = 0; @@ -320,6 +328,13 @@ int AVP_Start(AVP_HANDLE player, AVP_PlayerConfig *config) { } else ALOGE("BTF|%s|%d|IN| load volume fail", __FUNCTION__,__LINE__); startCheckDecoderStatistics(player); + + if( socPlayerInfo->pip ){ + pthread_mutex_unlock(&pip_mutex); + }else{ + pthread_mutex_unlock(&main_mutex); + } + ALOGD("BTF|%s|%d|OUT| \n", __FUNCTION__,__LINE__); @@ -332,6 +347,12 @@ int AVP_Stop(AVP_HANDLE player) { CHECK_NULL_PLAYER(player); synaptics_player_info *socPlayerInfo = (synaptics_player_info *) player; + + if( socPlayerInfo->pip ){ + pthread_mutex_lock(&pip_mutex); + }else{ + pthread_mutex_lock(&main_mutex); + } stopCheckDecoderStatistics(); @@ -359,7 +380,13 @@ int AVP_Stop(AVP_HANDLE player) { if(logFp[socPlayerInfo->pip ? 1:0] != NULL) fclose(logFp[socPlayerInfo->pip ? 1:0]); #endif - + + if( socPlayerInfo->pip ){ + pthread_mutex_unlock(&pip_mutex); + }else{ + pthread_mutex_unlock(&main_mutex); + } + ALOGD("BTF|%s|%d|OUT| \n", __FUNCTION__,__LINE__); return 0; @@ -454,6 +481,13 @@ int AVP_FlushTS(AVP_HANDLE player) { ALOGD("BTF|%s|%d|IN| player=%x\n", __FUNCTION__,__LINE__, player); synaptics_player_info *socPlayerInfo = (synaptics_player_info *) player; + + if( socPlayerInfo->pip ){ + pthread_mutex_lock(&pip_mutex); + }else{ + pthread_mutex_lock(&main_mutex); + } + amp_stop_pipeline(player); amp_clear_port_buf(player); @@ -463,7 +497,13 @@ int AVP_FlushTS(AVP_HANDLE player) { amp_reset_buffer(socPlayerInfo); amp_start_pipeline(player); - + + if( socPlayerInfo->pip ){ + pthread_mutex_unlock(&pip_mutex); + }else{ + pthread_mutex_unlock(&main_mutex); + } + ALOGD("BTF|%s|%d|OUT| \n", __FUNCTION__,__LINE__); return 0;