-
Notifications
You must be signed in to change notification settings - Fork 106
fix: fix bluetooth audio port priority assignment #955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR refactors audio configuration and module management by removing legacy file-based settings, replacing pactl exec invocations with direct context API calls for module loading/unloading, streamlines Bluetooth port priority logic, simplifies gesture action dispatch, and updates module dependencies. Sequence diagram for direct module unload via context API (unsetMono/unsetReduceNoise)sequenceDiagram
participant Audio
participant Context
Audio->>Context: UnloadModuleByName("module-remap-sink")
Audio->>Context: UnloadModuleByName("module-echo-cancel")
Audio->>Context: UnloadModule(module.Index)
Sequence diagram for gesture action dispatch via doActionByNamesequenceDiagram
participant Manager
participant doActionByName
participant actionInfo
Manager->>doActionByName: Call with action name
loop For each action in actions
doActionByName->>actionInfo: If action.Name matches, call fn()
end
Class diagram for refactored Audio module managementclassDiagram
class Audio {
+saveConfig()
+doSaveConfig()
+unsetMono()
+setMono(enable bool)
+unsetReduceNoise()
+hasReduceNoise(source string)
-saveAudioState()
}
class Sink {
+SetVolume(value float64, isPlay bool)
+SetMono(enable bool)
-audio: Audio
}
Audio <|-- Sink
Audio : context()
Audio : getDefaultSinkName()
Audio : getDefaultSourceName()
Audio : saveAudioState()
Audio : unsetMono()
Audio : unsetReduceNoise()
Audio : hasReduceNoise(source string)
Sink : SetMono(enable bool)
Sink : audio
Sink : SetVolume(value float64, isPlay bool)
Class diagram for updated Card port priority logicclassDiagram
class Card {
+update(card *pulse.Card)
+sortPortsByPriority(card *pulse.Card)
}
class pulse.CardPortInfo {
+Name string
+Profiles []Profile
+Priority int
+Available int
}
Card : update(card *pulse.Card)
Card : sortPortsByPriority(card *pulse.Card)
Card --> pulse.CardPortInfo : uses
class Profile {
+Name string
+Available int
}
Profile <|-- pulse.CardPortInfo : part of
Card : portBluezMode(port *pulse.CardPortInfo) string
Class diagram for simplified gesture action dispatchclassDiagram
class Manager {
+Exec(evInfo EventInfo) error
+GetInterfaceName() string
-gesture gesture.Gesture
-dock dock.Dock
-display display.Display
}
class actionInfo {
+Name string
+fn func() error
}
Manager : Exec(evInfo EventInfo) error
Manager : GetInterfaceName() string
Manager : doToggleNotifications() error
Manager : doActionByName(name string) error
Manager --> actionInfo : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes address Bluetooth audio port priority issues by improving the priority assignment logic. Previously, port priorities were hardcoded based on port names, which was unreliable. Now priorities are determined by analyzing the port's profile information to accurately identify the audio mode (A2DP, headset, or handsfree). Additionally, the audio configuration system has been simplified by removing unused configuration file handling code and the first-run initialization logic since these features are no longer needed. Log: Fixed Bluetooth audio port priority assignment to correctly identify audio modes Influence: 1. Test Bluetooth audio device connection and automatic profile selection 2. Verify A2DP mode has higher priority than headset mode 3. Check that audio switches correctly between different Bluetooth profiles 4. Test audio output quality in different Bluetooth modes 5. Verify mono audio settings work properly with Bluetooth devices fix: 修复蓝牙音频端口优先级分配问题 本次修改解决了蓝牙音频端口优先级问题,改进了优先级分配逻辑。之前基于端口 名称硬编码优先级的方式不可靠,现在通过分析端口的配置文件信息来准确识别音 频模式(A2DP、耳机或免提)。此外,简化了音频配置系统,移除了未使用的配置 文件处理代码和首次运行初始化逻辑,因为这些功能不再需要。 Log: 修复蓝牙音频端口优先级分配,正确识别音频模式 Influence: 1. 测试蓝牙音频设备连接和自动配置文件选择 2. 验证A2DP模式优先级高于耳机模式 3. 检查音频在不同蓝牙配置文件之间正确切换 4. 测试不同蓝牙模式下的音频输出质量 5. 验证单声道设置与蓝牙设备正常工作
deepin pr auto review我来对这段代码进行审查和分析:
a) audio.go中的变更:
b) audio_config.go中的变更:
c) bluez_audio.go中的变更:
d) card.go中的变更:
这些变更总体上简化了代码结构,但需要注意对现有功能的影响,特别是配置相关的变更。建议在部署前进行充分的测试。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fly602, mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary by Sourcery
Simplify audio configuration, refactor module unloading, improve BlueZ port priority handling, streamline gesture action invocation, remove legacy files, and update dependencies.
Enhancements:
Build:
Chores: