From: luozheng <1732036298@qq.com> Date: Mon, 11 May 2026 06:08:50 +0000 (+0800) Subject: 解决n9打电话没有声音问题 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F3407%2Fhead;p=mirrors%2FFD230.git 解决n9打电话没有声音问题 --- diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_player_service.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_player_service.cpp index 3e99cd0a7..781683101 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_player_service.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_player_service.cpp @@ -517,6 +517,12 @@ int32_t AudioPlayerService::StartPrepare(void) return MEDIA_OK; } +bool AudioPlayerService::HasM3U8(const std::string& str) +{ + size_t pos = str.find(".m3u8"); + return pos != std::string::npos; +} + int32_t AudioPlayerService::Start(void) { if (currentState_ != AudioPlayerStates::AUDIO_PLAYER_IDLE) { @@ -535,6 +541,9 @@ int32_t AudioPlayerService::Start(void) ResetAudioPlayState(); currentState_ = AudioPlayerStates::AUDIO_PLAYER_ENTERED; MediaThreadattr attr = { "AudioPlayThread", 0x1800, THREAD_SCHED_INVALID, 0, true }; + if (HasM3U8(playList_.at(playIndex_))) { + attr.stackSize = 0x9000; + } threadHandle_ = MediaThreadCreate(AudioPlayThread, this, &attr); if (threadHandle_ == nullptr) { MEDIA_ERR_LOG("create thread failed"); @@ -869,6 +878,10 @@ void AudioPlayerService::GetAlbumInfo(AudioPlayerAlbumInfo &albumInfo, const cha MEDIA_ERR_LOG("src is nullptr!"); return; } + if (strncmp(src, "http", 4) == 0) { // 4 means lenth of string "http" + MEDIA_ERR_LOG("GetAlbumInfo unsupport http play"); + return; + } if (albumInfoPlayer_ == nullptr) { albumInfoPlayer_= std::make_shared(); } diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp index 0b93f7e51..003f8e640 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp @@ -630,7 +630,7 @@ static int32_t StartVoiceCall(const char **param) { MediaInitStaticMutexLock(&g_voiceCallVolteContextMutex); MediaMutexLock(g_voiceCallVolteContextMutex); - int32_t type = strtol(param[0x1], nullptr, NUMBER_BASE); + int32_t type = 0;//strtol(param[0x1], nullptr, NUMBER_BASE); if (g_voiceCallVolteContext != nullptr) { MEDIA_ERR_LOG("invalid operation"); MediaMutexUnLock(g_voiceCallVolteContextMutex); @@ -710,7 +710,8 @@ static int32_t VoiceCAllSeaEnable(const char **param) MEDIA_ERR_LOG("not support set sae enable!"); return -1; } - int32_t enable = strtol(param[0x1], nullptr, NUMBER_BASE); + int32_t enable = 1;//strtol(param[0x1], nullptr, NUMBER_BASE); + MEDIA_ERR_LOG("enable %d",enable); int32_t ret = 0; if (enable == 0) { ret = AudioManagerSetSeaEnable(false); diff --git a/code/sdk/middleware/services/media/foundation/utils/src/media_thread_adapt.cpp b/code/sdk/middleware/services/media/foundation/utils/src/media_thread_adapt.cpp index cbb927404..3a2bdc581 100644 --- a/code/sdk/middleware/services/media/foundation/utils/src/media_thread_adapt.cpp +++ b/code/sdk/middleware/services/media/foundation/utils/src/media_thread_adapt.cpp @@ -314,7 +314,7 @@ static int32_t MediaDoCreateThread(MediaThreadMember *member, const MediaThreada attr->name, attrBits, nullptr, 0, nullptr, attr->stackSize, osPriorityNormal, 0, 0 }; if (strcmp(attr->name, "AudioPlayThread") == 0) { - taskAttr.stack_mem = memalign(16, attr->stackSize); // 16×Ö½Ú¶ÔÆë£¬ÉêÇëÄÚ´æµ½psram + taskAttr.stack_mem = memalign(16, attr->stackSize); // 16字节对齐,申请内存到psram member->stackMem = taskAttr.stack_mem; } MediaSetCmsisThreadPriorityAttr(taskAttr, attr->prioty); diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c index bdc7a4284..433d29b6b 100644 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c @@ -196,7 +196,8 @@ static int32_t AIDevOpen(td_handle *aiHandle, enum AudioCategory audioCategory) return ret; } uapi_ai_gain gain = {}; - gain.integer = DEFAULTE_AI_VOL_DB_INTERGER; + // gain.integer = DEFAULTE_AI_VOL_DB_INTERGER; + gain.integer = gain.integer + 10; // 前端mic灵敏度不同可通过此处调增,增加4db增益 默认gain.integer = gain.integer+4 gain.decimal = 0; MEDIA_HAL_LOGI(MODULE_NAME, "set default AI volume.integer = %d, decimal = %d", gain.integer, gain.decimal); MEDIA_HAL_DOFUNC_TIME(ret = uapi_ai_set_volume(*aiHandle, &gain));