From 10d07f46abff0bb4bc6e50d5c99dd35cf8a71f80 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 5 Nov 2024 16:32:27 +0800 Subject: [PATCH] =?utf8?q?1.=E5=85=B3=E9=97=AD=E5=A4=9A=E4=BD=99=E6=89=93?= =?utf8?q?=E5=8D=B0(=E5=8C=85=E5=90=ABplayer=5Fimpl=E6=96=87=E4=BB=B6?= =?utf8?q?=E7=9A=84=E4=B8=80=E4=B8=AA=E6=89=93=E5=8D=B0)=202.=E8=A7=A3?= =?utf8?q?=E5=86=B3=E6=89=8B=E8=A1=A8=E9=87=8D=E5=90=AF=E7=AB=8B=E9=A9=AC?= =?utf8?q?=E5=90=8C=E6=AD=A5=E9=9F=B3=E4=B9=90=E6=88=90=E5=8A=9F=E5=90=8E?= =?utf8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E6=92=AD=E6=94=BE=E6=8C=89=E9=92=AE?= =?utf8?q?=E4=B8=8D=E6=92=AD=E6=94=BE=E9=9C=80=E8=A6=81=E5=9C=A8=E5=88=87S?= =?utf8?q?lice=E6=89=8D=E8=83=BD=E6=92=AD=E6=94=BEbug=203.=E8=A7=A3?= =?utf8?q?=E5=86=B3=E5=9C=A8=E6=89=8B=E8=A1=A8=E5=8F=AA=E6=9C=89=E4=B8=80?= =?utf8?q?=E9=A6=96=E6=AD=8C=E6=9B=B2=E6=97=B6=E5=80=99=E4=B8=94=E5=9C=A8?= =?utf8?q?=E6=92=AD=E6=94=BE=EF=BC=8C=E6=89=8B=E6=9C=BAapp=E5=88=A0?= =?utf8?q?=E9=99=A4=E6=9C=AC=E5=9C=B0=E9=9F=B3=E4=B9=90=EF=BC=8C=E6=89=8B?= =?utf8?q?=E8=A1=A8=E4=B8=8D=E4=BC=9A=E4=BC=9A=E5=81=9C=E6=AD=A2=E5=BD=93?= =?utf8?q?=E5=89=8D=E6=92=AD=E6=94=BE=E7=9A=84=E6=AD=8C=E6=9B=B2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/alarm/src/AlarmClockModel.cpp | 2 +- .../bluetooth/src/BluetoothHeadsetEvent.cpp | 14 ++-- .../nativeui/player/src/PlayersModel.cpp | 9 ++- .../player/frameworks/player_impl.cpp | 74 +++++++++---------- 4 files changed, 51 insertions(+), 48 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp index 5fc0d55d2..5f66a125f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp @@ -337,7 +337,7 @@ bool AlarmClockModel::JudgeClockModel(uint16_t num) uint8_t AlarmClockModel::GetAlarmId(void) { for (int num = 0; num < CLOCK_MAX; num++) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::GetAlarmId alarmId[%d] = %d", num, alarmId[num]); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::GetAlarmId alarmId[%d] = %d", num, alarmId[num]); } for (int num = 0; num < CLOCK_MAX; num++) { if (alarmId[num] == 0) { //如果某个元素的值为 0,表示这个 ID 尚未被使用 diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp index bc1379a4b..b5e923687 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp @@ -30,7 +30,7 @@ BtAvrcpTgInf g_avrcp_srv_inf; void BtAvrcpVolumeChangedSyncMedia(uint8_t a2dp_volume) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[BtAvrcpVolumeChangedSyncMedia]::a2dp_volume = 0x%x\r\n", a2dp_volume); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[BtAvrcpVolumeChangedSyncMedia]::a2dp_volume = 0x%x\r\n", a2dp_volume); int32_t audio_volume = a2dp_volume * BT_A2DP_MEDIA_VOL_LEVEL / AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100; AudioManager::GetInstance().SetVolume(AUDIO_STREAM_A2DP_MUSIC, audio_volume); /* 设置增益音量 */ g_avrcp_tg_local_media_vol = a2dp_volume; @@ -97,7 +97,7 @@ void PressButtonStatusCallback(td_u32 keyOperation, td_u32 keyValue) void BtAvrcpTgNotifyVolumeChangedProc(uint8_t a2dp_volume) { int32_t audio_volume = a2dp_volume * BT_A2DP_MEDIA_VOL_LEVEL / AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "NotifyVolume = %d", audio_volume); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NotifyVolume = %d", audio_volume); AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, audio_volume); // 耳机连接手表场景调节手表音量 /* ---------------------------- 若当前音乐播放器为手机音乐则同步更新音乐播放器的声音进度条 --------------------------- */ if(PlayersModel::GetInstance()->GetMusicSource()) @@ -161,11 +161,11 @@ uint8_t BtAvrcpTgGetLocMediaVolume(void) if (g_avrcp_tg_local_media_vol == AVRCP_ABSOLUTE_VOLUME_INVALID) { int32_t audio_volume = AudioManager::GetInstance().GetVolume(AUDIO_STREAM_A2DP_MUSIC); uint8_t a2dp_volume = (uint8_t)(audio_volume * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100 / BT_A2DP_MEDIA_VOL_LEVEL); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "audio_volume 0x%x, a2dp_volume 0x%x\n", audio_volume, a2dp_volume); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "audio_volume 0x%x, a2dp_volume 0x%x\n", audio_volume, a2dp_volume); g_avrcp_tg_local_media_vol = a2dp_volume; } - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "get local media volume, a2dp_volume = 0x%x", g_avrcp_tg_local_media_vol); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "get local media volume, a2dp_volume = 0x%x", g_avrcp_tg_local_media_vol); return g_avrcp_tg_local_media_vol; } @@ -234,7 +234,7 @@ static bd_addr_t *BtAvrcpSrvGetActiveAddr(void) void ConnectTgStateChangedCallback(const bd_addr_t *bdAddr, profile_connect_state_t state) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "avrcp tg update conn stat:%u", state); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "avrcp tg update conn stat:%u", state); if (bdAddr == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bdaddr nullptr"); return; @@ -344,7 +344,7 @@ static void BtAvrcpPressReleaseButtonLog(uint32_t key_operation) static void BtAvrcpCtReleaseButtonRspCallback(const bd_addr_t *bd_addr, int32_t key_operation) { UNUSED(bd_addr); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "avrcp ct release button cbk key:%x\n", key_operation); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "avrcp ct release button cbk key:%x\n", key_operation); if (g_avrcp_srv_inf.avrcp_button_flag == AVRCP_SRV_PRESS_VALUE) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "avrcp ct released button button_flag change:%u->%u\n", g_avrcp_srv_inf.avrcp_button_flag, AVRCP_SRV_RELEASED_VALUE); @@ -453,7 +453,7 @@ static void BtAvrcpCtGetPlayStatusCallback(const bd_addr_t *bd_addr, avrcp_ct_pl static void BtAvrcpCtHdlNotifyVolumeRspCbk(avrcp_ct_notification_value_cb_t *notification) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[BtAvrcpCtHdlNotifyVolumeRspCbk] volume: 0x%x\n", + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[BtAvrcpCtHdlNotifyVolumeRspCbk] volume: 0x%x\n", notification->volume); /* 注册事件后通知的音量 */ BtAvrcpTgNotifyVolumeChangedProc((uint8_t)notification->volume); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp index 255ad686a..4d768468d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp @@ -255,6 +255,8 @@ int PlayersModel::PlayerInit(void) sliceId = PlayersListGroup::GetInstance()->GetCase(currentIndex); if (sliceId == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetCase %d sliceId err !!!", currentIndex); + PlayersModel::GetInstance()->PlayerStop(); /*停止音乐*/ + PlayersModel::GetInstance()->ClearActivateAudioInterrupt(); char strFile[BUFFER_SIZE] = "No music files"; sliceId = strFile; } @@ -759,13 +761,13 @@ void PlayersModel::GetDuration(int64_t &duration) bool PlayersModel::CreateMusicPlayDirectory(const char* path) { if (access(path, F_OK) == -1) { // 如果路径不存在 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Directory %s not exist, creating directory\n", path); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Directory %s not exist, creating directory\n", path); if (mkdir(path, 0777)!= 0) { // 尝试创建目录,如果创建失败 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Create directory %s failed\n", path); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create directory %s failed\n", path); return false; } } else { // 如果路径存在 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Directory %s already exists\n", path); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Directory %s already exists\n", path); } return true; } @@ -791,6 +793,7 @@ void PlayersModel::UpdateMusicPlayerList(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersModel::UpdateMusicPlayerList"); PlayersListGroup::GetInstance()->SetUpListCase(); + PlayersModel::GetInstance()->PlayerInit(); PlayersView *playersView = PlayersView::GetInstance(); if (playersView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OptionsButtonOnClick playersView nullptr err"); diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_impl.cpp b/code/sdk/middleware/services/media/foundation/player/frameworks/player_impl.cpp index 42dc93487..2f250a1ff 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_impl.cpp +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_impl.cpp @@ -665,7 +665,7 @@ bool Player::PlayerImpl::IsSingleLooping() int32_t Player::PlayerImpl::GetPlayerState(int32_t &state) { - MEDIA_INFO_LOG("process in"); + // MEDIA_INFO_LOG("process in");//关闭这个打印 MediaMutexLock(lock_); CHECK_FAILED_RETURN_WITH_UNLOCK(released_, false, -1, "have released or not create", lock_); state = currentState_; @@ -1481,10 +1481,10 @@ void Player::PlayerImpl::PrintAudioAndVideoDumpInfo(const PlayerAudioDebugInfo * void Player::PlayerImpl::PrintPlayerDumpInfo(const PlayerDebugInfo *playerInfo) { - if (formatFileInfo_.s64Duration != -1) { - printf("-----------Player file info-----------\n"); - PrintFileDumpInfo(&playerInfo->fileDebugInfo); - printf("\n"); + if (formatFileInfo_.s64Duration != -1) { + printf("-----------Player file info-----------\n"); + PrintFileDumpInfo(&playerInfo->fileDebugInfo); + printf("\n"); } if (player_ != nullptr) { printf("-----------Player stream info-----------\n"); @@ -1503,40 +1503,40 @@ void Player::PlayerImpl::PlayerThreadCondSignal(void) int32_t Player::PlayerImpl::DumpInfo(PlayerDebugInfo *playerInfo) { - if (playerInfo == nullptr) { - MEDIA_ERR_LOG("playerInfo is NULL!"); - return -1; + if (playerInfo == nullptr) { + MEDIA_ERR_LOG("playerInfo is NULL!"); + return -1; } playerInfo->fileDebugInfo.streamType = audioStreamType_; - if (formatFileInfo_.s64Duration != -1) { - playerInfo->fileDebugInfo.s64StartTime = formatFileInfo_.s64StartTime; - playerInfo->fileDebugInfo.s64Duration = formatFileInfo_.s64Duration; - playerInfo->fileDebugInfo.s64FileSize = formatFileInfo_.s64FileSize; - playerInfo->fileDebugInfo.s32UsedAudioStreamIndex = formatFileInfo_.s32UsedAudioStreamIndex; - playerInfo->fileDebugInfo.s32UsedVideoStreamIndex = formatFileInfo_.s32UsedVideoStreamIndex; - if (formatFileInfo_.s32UsedVideoStreamIndex >= 0) { - playerInfo->videoDebugInfo.s32UsedVideoStreamIndex = formatFileInfo_.s32UsedVideoStreamIndex; - } - if (formatFileInfo_.s32UsedAudioStreamIndex >= 0) { - playerInfo->audioDebugInfo.s32UsedAudioStreamIndex = formatFileInfo_.s32UsedAudioStreamIndex; - playerInfo->audioDebugInfo.sampleFmt = formatFileInfo_.sampleFmt; - playerInfo->audioDebugInfo.u32SampleRate = formatFileInfo_.u32SampleRate; - playerInfo->audioDebugInfo.u32AudioChannelCnt = formatFileInfo_.u32AudioChannelCnt; - } - } - if (player_ != nullptr) { - player_->GetPlayerControlDumpInfo(playerInfo->playControlInfo); - playerInfo->playControlInfo.speed = speed_; - playerInfo->playControlInfo.rewindPosition = rewindPosition_; - playerInfo->playControlInfo.playerControlState = playerControlState_; - playerInfo->playControlInfo.isSingleLoop = isSingleLoop_; - player_->GetPlayerFileDumpInfo(playerInfo->fileDebugInfo); - if (formatFileInfo_.s32UsedVideoStreamIndex >= 0) { - player_->GetPlayerVideoDumpInfo(playerInfo->videoDebugInfo); - } - if (formatFileInfo_.s32UsedAudioStreamIndex >= 0) { - player_->GetPlayerAudioDumpInfo(playerInfo->audioDebugInfo); - } + if (formatFileInfo_.s64Duration != -1) { + playerInfo->fileDebugInfo.s64StartTime = formatFileInfo_.s64StartTime; + playerInfo->fileDebugInfo.s64Duration = formatFileInfo_.s64Duration; + playerInfo->fileDebugInfo.s64FileSize = formatFileInfo_.s64FileSize; + playerInfo->fileDebugInfo.s32UsedAudioStreamIndex = formatFileInfo_.s32UsedAudioStreamIndex; + playerInfo->fileDebugInfo.s32UsedVideoStreamIndex = formatFileInfo_.s32UsedVideoStreamIndex; + if (formatFileInfo_.s32UsedVideoStreamIndex >= 0) { + playerInfo->videoDebugInfo.s32UsedVideoStreamIndex = formatFileInfo_.s32UsedVideoStreamIndex; + } + if (formatFileInfo_.s32UsedAudioStreamIndex >= 0) { + playerInfo->audioDebugInfo.s32UsedAudioStreamIndex = formatFileInfo_.s32UsedAudioStreamIndex; + playerInfo->audioDebugInfo.sampleFmt = formatFileInfo_.sampleFmt; + playerInfo->audioDebugInfo.u32SampleRate = formatFileInfo_.u32SampleRate; + playerInfo->audioDebugInfo.u32AudioChannelCnt = formatFileInfo_.u32AudioChannelCnt; + } + } + if (player_ != nullptr) { + player_->GetPlayerControlDumpInfo(playerInfo->playControlInfo); + playerInfo->playControlInfo.speed = speed_; + playerInfo->playControlInfo.rewindPosition = rewindPosition_; + playerInfo->playControlInfo.playerControlState = playerControlState_; + playerInfo->playControlInfo.isSingleLoop = isSingleLoop_; + player_->GetPlayerFileDumpInfo(playerInfo->fileDebugInfo); + if (formatFileInfo_.s32UsedVideoStreamIndex >= 0) { + player_->GetPlayerVideoDumpInfo(playerInfo->videoDebugInfo); + } + if (formatFileInfo_.s32UsedAudioStreamIndex >= 0) { + player_->GetPlayerAudioDumpInfo(playerInfo->audioDebugInfo); + } } PrintPlayerDumpInfo(playerInfo); return 0; -- 2.17.1