Skip to content
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

fix: 适配pipewire,解决音频切换无声音,切换失败的问题 #716

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

fly602
Copy link
Contributor

@fly602 fly602 commented Dec 19, 2024

适配pipewire,解决音频切换无声音,切换失败的问题

Log: 适配pipewire,解决音频切换无声音,切换失败的问题
pms: BUG-294121

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602, zsien

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

TAG Bot

TAG: 6.1.14
EXISTED: yes
DISTRIBUTION: unstable

适配pipewire,解决音频切换无声音,切换失败的问题

Log: 适配pipewire,解决音频切换无声音,切换失败的问题
pms: BUG-294121
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. audio.go文件中,refreshDefaultSinkSource函数中新增了对firstSinkPort的处理,但未对firstSinkPort的值进行有效性检查,可能会导致空指针异常。建议在访问firstSinkPort的属性之前,先检查其是否为nil

  2. setPort函数中,当portNamedndVirtualSinkNamecardIdmath.MaxUint32时,直接设置了defaultSink,但没有检查portName的有效性。建议在设置defaultSink之前,先验证portName是否有效。

  3. setPort函数中,当directionpulse.DirectionSinktargetPortInfo.Profiles.Exists("a2dp_sink")时,将targetProfile设置为"a2dp_sink",但没有考虑到其他可能的配置文件。建议在设置targetProfile之前,先检查所有可能的配置文件,以确保选择的是合适的配置文件。

  4. handleCardChangedhandleSinkChanged函数中,当a.defaultSink不为nilidx等于a.defaultSink.Card时,直接设置了BluetoothAudioMode,但没有考虑到其他可能的配置文件。建议在设置BluetoothAudioMode之前,先检查所有可能的配置文件,以确保选择的是合适的配置文件。

  5. bluez_audio.go文件中,BluezModeOpts函数中使用了strings.ReplaceAll来替换字符串中的字符,但未对profile.Name进行有效性检查,可能会导致空指针异常。建议在调用strings.ReplaceAll之前,先检查profile.Name是否为nil

  6. card.go文件中,update函数中使用了isBluetoothCard函数来判断是否为蓝牙声卡,但该函数在card_profile_workaround.go文件中被移除。建议在update函数中使用isBluezAudio函数来替代isBluetoothCard函数。

  7. card.go文件中,stringstringWithoutUnavailable函数中使用了isBluetoothCard函数来判断是否为蓝牙声卡,但该函数在card_profile_workaround.go文件中被移除。建议在stringstringWithoutUnavailable函数中使用isBluezAudio函数来替代isBluetoothCard函数。

  8. card_profile_workaround.go文件中,isBluetoothCard函数被移除,但其他文件中仍然在使用。建议在所有文件中统一使用isBluezAudio函数来替代isBluetoothCard函数。

  9. card_profile_workaround.go文件中,tryConnectBluetooth函数中使用了bluePath变量,但未对bluePath进行有效性检查,可能会导致空指针异常。建议在访问bluePath之前,先检查其是否为nil

  10. card_profile_workaround.go文件中,tryConnectBluetooth函数中使用了c.PropList["bluez.path"]来获取蓝牙路径,但没有考虑到PropList可能为nil的情况。建议在访问PropList之前,先检查其是否为nil

@fly602 fly602 merged commit 9d363f5 into linuxdeepin:master Dec 23, 2024
14 of 16 checks passed
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.

3 participants