Skip to content

[codex] Feed NetworkBoost signals into ABR#32

Merged
qiin2333 merged 2 commits into
masterfrom
codex/api24-p0-followups
Jun 1, 2026
Merged

[codex] Feed NetworkBoost signals into ABR#32
qiin2333 merged 2 commits into
masterfrom
codex/api24-p0-followups

Conversation

@qiin2333
Copy link
Copy Markdown
Contributor

@qiin2333 qiin2333 commented May 29, 2026

Summary

  • Wire NetworkBoostKit QoS and scene callbacks into the adaptive bitrate service.
  • Forward fresh system QoS/scene hints to the server-side ABR feedback payload.
  • Use weak-signal, congestion, and handover scene hints to proactively reduce bitrate in local ABR fallback mode.

Why

The previous API24 NetworkBoost follow-up only surfaced net scene changes to the UI. This makes the signal actionable for streaming quality: the ABR controller can react before packet loss becomes visible in the native stream stats.

Validation

  • Ran git diff --check successfully.
  • Attempted local hvigor build, but this workstation's HarmonyOS SDK setup is incomplete: DevEco hvigor reports SDK component missing / invalid DEVECO_SDK_HOME before reaching ArkTS compilation.

Summary by CodeRabbit

发布说明

  • 新功能
    • 自适应码率决策整合系统级 QoS 与网络场景监听,缓存并校验新鲜度以优化决策
    • 网络反馈上报扩展,新增系统 RTT、上/下行带宽、上行缓冲延迟/拥塞、网络场景、推荐动作及弱信号起止与持续时长等指标
    • 本地回退新增场景缓解分支:按缓解系数调整码率、重置稳定计数并支持冷却窗口以防重复触发

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c4e15564-d303-443d-80aa-07257c1c74e7

📥 Commits

Reviewing files that changed from the base of the PR and between 11ccb52 and 4b505c9.

📒 Files selected for processing (1)
  • entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
🚧 Files skipped from review as they are similar to previous changes (1)
  • entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets

📝 Walkthrough

走查

该 PR 在自适应码率控制服务中集成系统网络 QoS 与场景信息,扩展 ABR 报告数据,并在本地 fallback 模式下引入基于系统场景的动态缓解机制。新增 TTL 与冷却时间机制确保数据新鲜度与避免频繁重复触发。

变更

自适应码率控制系统数据集成与场景缓解

检查点 说明
网络反馈数据契约
entry/src/main/ets/service/streaming/NvHttp.ets, entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
NetworkFeedback 接口新增系统 RTT、缓冲延迟、拥塞率、上下行带宽、网络场景、推荐动作与弱信号等可选字段;导入 NetworkBoostService 类型与 SceneMitigation 缓解结构。
NetworkBoost 信号生命周期管理
entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
新增系统 QoS/场景缓存字段、监听器引用与 TTL/冷却常量;start() 后订阅网络信号,stop() 前取消订阅;resetState() 与专用订阅管理函数维护缓存与监听器状态。
服务端 ABR 报告系统数据集成
entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
tickServer() 中优先使用本地 networkLatency 填 rttMs(若可用),否则在存在新鲜系统 QoS 时使用其 rttMs;在系统数据可用时补充 systemRttMs、systemUpBufferDelayMs、带宽/拥塞/scene/recommendedAction 与弱信号起止字段。
本地 Fallback 场景缓解机制
entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
tickLocal() 新增场景缓解分支,根据新鲜系统场景与弱信号计算缓解因子直接调整码率,维护缓解 key 的冷却窗口;仅在码率变更成功后更新冷却状态;未匹配时继续走丢包分级逻辑。

🎯 3 (中等) | ⏱️ ~25 分钟

"我是一只小兔子,跳过网络风暴,
用温柔的倍数保住画面流畅,
TTL 像胡萝卜,冷却像窝的温度,
在系统信号的春风里,我悄悄修整步伐,
把稳定和欢快留给每一个观众 🐇✨"

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题[codex] Feed NetworkBoost signals into ABR准确反映了主要变更内容:将NetworkBoost信号集成到ABR服务中。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/api24-p0-followups

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qiin2333 qiin2333 force-pushed the master branch 10 times, most recently from 034d93e to b90a1fd Compare May 29, 2026 14:34
Rebase PR changes onto current master and keep the ABR/NetworkBoost updates while preserving the CI SDK fixes already landed on master.
@qiin2333 qiin2333 force-pushed the codex/api24-p0-followups branch from 212b775 to 11ccb52 Compare June 1, 2026 09:40
@qiin2333 qiin2333 marked this pull request as ready for review June 1, 2026 09:50
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets`:
- Around line 399-405: getSceneMitigation() currently updates
lastSceneMitigationKey and lastSceneMitigationTime before attempting a bitrate
change, which causes a cooldown even if onBitrateChange() fails; instead, remove
the writes to lastSceneMitigationKey/Time from getSceneMitigation() and move
them into the success path of onBitrateChange() (only set these fields after the
bitrate change completes successfully), and apply the same change for the other
similar block (the code around lines 421-473) so cooldown is only recorded on
successful adjustments.
- Around line 235-237: The current sceneListener stores a relative
weakSignalStartSec inside the cached scene snapshot (latestSystemScene), causing
the same seconds value to be reused for the TTL duration; instead, when
receiving a scene in sceneListener convert relative weakSignalStartSec into
absolute timestamps (e.g. weakSignalStartAt / weakSignalEndAt using
latestSystemSceneAt or Date.now()) and store those absolute times on
latestSystemScene (or alongside it), and then change getSceneMitigation() to
compute remaining seconds from now against those absolute timestamps rather than
reading a stale relative weakSignalStartSec; apply the same conversion to the
other similar block referenced (lines ~353-375).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 19887984-f3cb-4e4d-aaf9-fe16eafca15c

📥 Commits

Reviewing files that changed from the base of the PR and between b90a1fd and 11ccb52.

📒 Files selected for processing (2)
  • entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
  • entry/src/main/ets/service/streaming/NvHttp.ets

Comment thread entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets Outdated
Comment thread entry/src/main/ets/service/streaming/AdaptiveBitrateService.ets
@qiin2333 qiin2333 merged commit f410694 into master Jun 1, 2026
2 checks passed
@qiin2333 qiin2333 deleted the codex/api24-p0-followups branch June 1, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant