解决n9打电话没有声音问题 3407/1 3407/head 3408/target/1
authorluozheng <1732036298@qq.com>
Mon, 11 May 2026 06:08:50 +0000 (14:08 +0800)
committerluozheng <1732036298@qq.com>
Mon, 11 May 2026 06:08:50 +0000 (14:08 +0800)
code/sdk/middleware/services/media/foundation/sample/wrapper/audio_player_service.cpp
code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp
code/sdk/middleware/services/media/foundation/utils/src/media_thread_adapt.cpp
code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c

index 3e99cd0..7816831 100644 (file)
@@ -517,6 +517,12 @@ int32_t AudioPlayerService::StartPrepare(void)
     return MEDIA_OK;\r
 }\r
 \r
+bool AudioPlayerService::HasM3U8(const std::string& str)\r
+{\r
+    size_t pos = str.find(".m3u8");\r
+    return pos != std::string::npos;\r
+}\r
+\r
 int32_t AudioPlayerService::Start(void)\r
 {\r
     if (currentState_ != AudioPlayerStates::AUDIO_PLAYER_IDLE) {\r
@@ -535,6 +541,9 @@ int32_t AudioPlayerService::Start(void)
     ResetAudioPlayState();\r
     currentState_ = AudioPlayerStates::AUDIO_PLAYER_ENTERED;\r
     MediaThreadattr attr = { "AudioPlayThread", 0x1800, THREAD_SCHED_INVALID, 0, true };\r
+    if (HasM3U8(playList_.at(playIndex_))) {\r
+        attr.stackSize = 0x9000;\r
+    }\r
     threadHandle_ = MediaThreadCreate(AudioPlayThread, this, &attr);\r
     if (threadHandle_ == nullptr) {\r
         MEDIA_ERR_LOG("create thread failed");\r
@@ -869,6 +878,10 @@ void AudioPlayerService::GetAlbumInfo(AudioPlayerAlbumInfo &albumInfo, const cha
         MEDIA_ERR_LOG("src is nullptr!");\r
         return;\r
     }\r
+    if (strncmp(src, "http", 4) == 0) { // 4 means lenth of string "http"\r
+        MEDIA_ERR_LOG("GetAlbumInfo unsupport http play");\r
+        return;\r
+    }\r
     if (albumInfoPlayer_ == nullptr) {\r
         albumInfoPlayer_= std::make_shared<Player>();\r
     }\r
index 0b93f7e..003f8e6 100644 (file)
@@ -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);
index cbb9274..3a2bdc5 100644 (file)
@@ -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);
index bdc7a42..433d29b 100644 (file)
@@ -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));