feat(bt): 批①后台常驻框架实施 — meow_media_app_resident按app会话判活跃+should_keep三参(keepalive||bg_audio&&resident)+background_keepalive声明解析透传+amsd EV BG/FG上报;宿主test_media39/test_bgplay/test_bg_keep19全过,0warning;落盘APP_BACKGROUND_KEEPALIVE_P1;降配(nice)待真机未做
This commit is contained in:
1 parent
7e68313981
commit
f3ae06d7cd
10 files changed
+330
-30
No files matched your search
@@ -63,9 +63,10 @@ void meow_bgplay_init(const meow_bgplay_ops *ops)
|
||||
|
||||
/* ================= 后台播放保活 ================= */
|
||||
|
||||
int meow_bg_should_keep(int bg_audio_declared, int media_playing)
|
||||
int meow_bg_should_keep(int bg_audio_declared, int media_resident, int keepalive_declared)
|
||||
{
|
||||
return bg_audio_declared && media_playing;
|
||||
if (keepalive_declared) return 1; /* 通用常驻:进后台即保活 */
|
||||
return bg_audio_declared && media_resident; /* 播放类:播放/暂停/缓冲都保活 */
|
||||
}
|
||||
|
||||
static meow_bg_entry_t *bg_find(const char *app_id)
|
||||
@@ -78,7 +79,7 @@ static meow_bg_entry_t *bg_find(const char *app_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int meow_bg_add(const char *app_id, pid_t pid, int out_fd, int on_card)
|
||||
int meow_bg_add(const char *app_id, pid_t pid, int out_fd, int on_card, int keepalive)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -94,8 +95,11 @@ int meow_bg_add(const char *app_id, pid_t pid, int out_fd, int on_card)
|
||||
e->pid = pid;
|
||||
e->out_fd = out_fd;
|
||||
e->on_card = on_card;
|
||||
e->bg_since_ms = bg_now_ms(); /* 批①:转后台时刻 */
|
||||
e->keepalive = keepalive ? 1 : 0; /* 批①:常驻类型标记 */
|
||||
g_change_seq++;
|
||||
bg_log("[bgplay] 转后台保活: %s pid=%d on_card=%d", app_id, (int)pid, on_card);
|
||||
bg_log("[bgplay] 转后台保活: %s pid=%d on_card=%d keepalive=%d",
|
||||
app_id, (int)pid, on_card, e->keepalive);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user