Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Server: compute the fade-in gain once per channel per frame, not once per channel pair

未关闭
#3,945 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

@mcfnord 已经在做这个了。

开始于 2026年9月21日。

  • #3959 来自 @mcfnord —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
c

调研方向

从 src/server.cpp 中构建 vecChanIDsCurConChan 的循环开始,检查 DecodeReceiveData,然后阅读 src/channel.h 中的 GetFadeInGain()。确认每个已连接通道的增益在每帧中获取一次,并在两次配对计算中重复使用,同时保持输出不变;使用链接的 benchmark 比较循环形状。

由索引模型根据 Issue 内容生成。

描述

AI refactoring

🤖 AI: Follow-up to ann0see/jamulus#293, opened at @ann0see's request.

What is the current behaviour and why should it be changed?

The gain loop in DecodeReceiveData calls GetFadeInGain() twice per channel pair, once for the source channel (line 909) and once for the target (line 915): 2N²−N int-to-float conversions and float divisions per frame, 44850 at N=150. The N values behind them are constant for the frame. Both counters are written only in PutAudioData and OnNetTranspPropsReceived, reached under CServer::Mutex from PutAudioData and OnProtocolMessageReceived, and OnTimer holds that mutex for the whole decode phase, single- or multithreaded.

Describe possible approaches

Read each connected channel's fade-in gain once into a CVector<float> in the loop that builds vecChanIDsCurConChan, and multiply by vecfFadeInGains[j] and vecfFadeInGains[iChanCnt] at lines 909 and 915 — #293's one-read-per-channel pattern applied to the remaining per-pair accessor, independent of that PR. The output is unchanged: a benchmark of the two loop shapes with a lock-free gain read produces byte-identical matrices at N=50, 100 and 150, and times the fade-in term alone (Raspberry Pi 4 Model B, g++ 14.2 -O2, median of 5 batches, 64-sample frame):

N per pair per frame saving share of a 1.33 ms frame
50 15.4 µs 5.4 µs 10.0 µs 0.75%
100 59.4 µs 21.3 µs 38.1 µs 2.9%
150 136.3 µs 40.6 µs 95.7 µs 7.2%

At the default 128-sample frame the microseconds are the same and the shares halve.

Has this feature been discussed and generally agreed?

Requested by @ann0see on #293; no PR until the design is agreed here.


🤖 This message was written by AI and reviewed by @mcfnord.

主要语言
C
星标
1.1k
派生
248
平均合并
7 天 14 小时
30 天内合并 PR
6

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jamulussoftware/jamulus 的其他 Issue

查看 jamulussoftware/jamulus 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。