Migrate pulseaudio to pipewire (New)#826
Conversation
|
/canonical/self-hosted-runners/run-workflows 94ea095 |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #826 +/- ##
==========================================
+ Coverage 34.83% 37.23% +2.40%
==========================================
Files 302 304 +2
Lines 34165 34774 +609
Branches 5909 6000 +91
==========================================
+ Hits 11901 12949 +1048
+ Misses 21698 21226 -472
- Partials 566 599 +33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
1. using `check_audio_deamon.sh` to check what environment is under testing to use right function for testing 2. Under pipewire, using `pw-dump` and `wpctl` to replace `pactl` command to collect information and settings. 3. the output of `pw-dump` is json format, therefore `pactl.py` isn't needed a alternative for pipewire. 4. `audio_settings.py` is buggy for selecting right device, change to use `show_default_audio_device.sh` to show the default device and let user to check. 5. using `wpctl status` to replace `audio_settings.py store` command
4eb393d to
306f4c1
Compare
a4b4a71 to
4b0a8df
Compare
|
/canonical/self-hosted-runners/run-workflows a48b4b2 |
Can you tell more about this issue? in which env? |
|
For DP, HDMI and Thunderbolt monitor, the name shows in OS are the same with only index different. Therefore, audio_settings.py will never know which one is correct then force to select one that might not the right one. If the validator isn't noticed this issue, the validator might make the wrong judgement. |
Is this the only issue you have with |
|
Other functions depend on pulseaudio that couldn't work on pipewire. |
I'm not familiar with PulseAudio and Pipewire, just start to learning it because of this PR :) We can discuss more once I figure out how to use it. |
|
Hook25
left a comment
There was a problem hiding this comment.
Allow me to endorse this comment: #826 (comment)
Looking at the changes from audio_test.py -> pipewire_test.py, it looks very clear to me that the two should be merged and use inheritance to obtain the result that we need.
Let me be more explicit, we have a super class here that is VolumeController, this class should contain all common functionality and the interface.
def run_retry(command):
# Since the audio system may return a failure if the audio layer is not
# yet initialized, we will try running a few times in case of failure.
# Do not use this if your command is not "idempotent",
# repeating them should not have any bad effects.
for attempt in range(0, 3):
try:
return subprocess.check_output(
command,
universal_newlines=True
)
except (subprocess.CalledProcessError):
time.sleep(5)
class VolumeController:
def __init__(self, controller_type, logger=None):
self.controller_type = controller_type
self.logger = logger
def set_volume(self, volume): pass
def get_volume(self): pass
def set_mute(self, mute): passThen we have two subclasses, one for pipewire and one for pulseaudio
class PulseVolumeController(VolumeController):
... # this is the one from audio_test.py with minor edits
class PipewireVolumeController(VolumeController):
... # this is from pipewire_test.pyThe main function is basically the same for the two modules (but the warning message, that should be moved inside the PulseVolumeController class. To select the audio system we want to test we can add a new cli argument with two possible choiches (pipewire, pulseaudio), and we initialize the correct instance in main depending on this argument value.
This kind of design should also make it trivial to add a new audio system or remove an old one, for example, if we ever deprecate testing pulseaudio systems via checkbox, we can just remove the argument and the class, and everything else will remain the same.
I did read most of this PR but I feel like the comments by @diohe0311 are correct, once those are addressed I can give some additional comments (I don't want them to overlap, lets do one review at the time!)
|
@hanhsuan Hi! we have updated the code review criteria I changed my formatting related comments to suggestions, @Hook25 Hanhsuan mentioned you guys will have a review meeting for this, just want to let you know that the mock input in test_pipewire_utils.py is highly identical(some of them is the same), but I'm not sure if it worth to do something to simplify it or just leave it be. |
2. Replacing regex to simplier method 3. Some minor fixes
2. Remove useless try catch in the unit test
Hook25
left a comment
There was a problem hiding this comment.
+1, this is probably going to need a followup but its a good base to work on. Thank you
* Migrate pulseaudio to pipewire 1. using `check_audio_deamon.sh` to check what environment is under testing to use right function for testing 2. Under pipewire, using `pw-dump` and `wpctl` to replace `pactl` command to collect information and settings. 3. the output of `pw-dump` is json format, therefore `pactl.py` isn't needed a alternative for pipewire. 4. `audio_settings.py` is buggy for selecting right device, change to use `show_default_audio_device.sh` to show the default device and let user to check. 5. using `wpctl status` to replace `audio_settings.py store` command * Add more unit tests * Remove assertLog to make code simplier * 1. Migrate show_default_audio_device.sh to pipewire_utils.py show 2. Replacing regex to simplier method 3. Some minor fixes * Add unit test for pipewire_utils show function * 1. Add logs 2. Remove useless try catch in the unit test
* Migrate pulseaudio to pipewire 1. using `check_audio_deamon.sh` to check what environment is under testing to use right function for testing 2. Under pipewire, using `pw-dump` and `wpctl` to replace `pactl` command to collect information and settings. 3. the output of `pw-dump` is json format, therefore `pactl.py` isn't needed a alternative for pipewire. 4. `audio_settings.py` is buggy for selecting right device, change to use `show_default_audio_device.sh` to show the default device and let user to check. 5. using `wpctl status` to replace `audio_settings.py store` command * Add more unit tests * Remove assertLog to make code simplier * 1. Migrate show_default_audio_device.sh to pipewire_utils.py show 2. Replacing regex to simplier method 3. Some minor fixes * Add unit test for pipewire_utils show function * 1. Add logs 2. Remove useless try catch in the unit test
This test case is missed to migrate in the canonical#826
This test case is missed to migrate in the canonical#826
…anonical#1106) migrate from pulseaudio to pipewire This test case is missed to migrate in the canonical#826
Description
check_audio_deamon.shto check what environment is under testing to use right function for testingpw-dumpandwpctlto replacepactlcommand to collect information and settings.pw-dumpis json format, thereforepactl.pyisn't needed a alternative for pipewire.audio_settings.pyis buggy for selecting right device, change to useshow_default_audio_device.shto show the default device and let user to check.wpctl statusto replaceaudio_settings.py storecommandResolved issues
#327
After Ubuntu 22.04, the audio will change from pulseaudio to pipewire. Therefore, the old test case should be migrated from pulseaudio to pipewire.
JIRA
Documentation
Tests
Jira Card CQT-2396