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

Pulseaudio remote #395

Closed
wants to merge 2 commits into from
Closed

Pulseaudio remote #395

wants to merge 2 commits into from

Conversation

josa41
Copy link
Contributor

@josa41 josa41 commented Dec 5, 2023

Description of changes

Initial Passthrough of Sound card for Lenovo X1 with pulseaudio backend for chromium
ADR documentation for the current implementation

Checklist for things done

  • Summary of the proposed changes in the PR description
  • More detailed description in the commit message(s)
  • Commits are squashed into relevant entities - avoid a lot of minimal dev time commits in the PR
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • PR linked to architecture documentation and requirement(s) (ticket id)
  • [ X] Test procedure described (or includes tests). Select one or more:
    • Tested on Lenovo X1 x86_64
    • [-] Tested on Jetson Orin NX or AGX aarch64
    • [-] Tested on Polarfire riscv64
  • [-] Author has run nix flake check --accept-flake-config and it passes
  • All automatic Github Action checks pass - see actions
  • Author has added reviewers and removed PR draft status

Testing

Chromium VM sound playback works on Lenovo X1
GuiVM can control pulseaudio with pamixer (or similar tool)
For GuiVM audio control:

# Open tcp-ssh tunnel to audioVM port 4713 in shell:
tcp-ssh audio-vm.ghaf 4713
# With the ssh tunnel AudioVM Pulseaudio server can be accessed from localhost:4713
export PULSE_SERVER=localhost
# use pamixer (for example to toggle mute with "-t")
pamixer -t

vilvo

This comment was marked as resolved.

@vilvo

This comment was marked as resolved.

@leivos-unikie
Copy link
Contributor

@leivos-unikie - please test this.

Started building...

Copy link
Contributor

@leivos-unikie leivos-unikie left a comment

Choose a reason for hiding this comment

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

Tested pamixer options on gui-vm while playing youtube video. Mute/unmute and setting volume seems to work fine from gui-vm.

However, I noticed some clear glitches in the sound while listening music. Compared also to my work laptop Lenovo T14 in the same home network, playing the same youtube video on chromium. What could be causing the bad audio quality in ghaf?

I couldn't launch Gala app, neither from command line. Other apps launch. Need to check still if this is specific to this PR or just inherited from the mainline.

@josa41
Copy link
Contributor Author

josa41 commented Dec 8, 2023

Its hard to say what is causing the glitches in the sound but Pulseaudio is known of not being really resource friendly and playback over a network connection from one vm to another is not ideal either. I could tweak the latency settings of Qemu-pulseaudio backend but i guess we are moving to pipewire anyway at some point so I don't see too much point spending the time playing with pulseaudio.
Gala app was not touched (to my knowledge) in this pr. In my build Gala starts from the icon.

@josa41 josa41 temporarily deployed to internal-build-workflow December 8, 2023 19:05 — with GitHub Actions Inactive
@leivos-unikie
Copy link
Contributor

I noticed now that Mika had reported already in November bug about NixOS 23.11 causing Gala not to launch.
https://ssrc.atlassian.net/browse/SP-3335

@josa41, maybe you had built a version with NixOS 23.05?

@josa41
Copy link
Contributor Author

josa41 commented Dec 11, 2023

Yes i had the older Nixos version. I updated and rebuild now, will test shortly.

@jenninikko jenninikko self-requested a review January 10, 2024 11:27
@josa41 josa41 temporarily deployed to internal-build-workflow January 11, 2024 12:20 — with GitHub Actions Inactive
@mikatammi mikatammi removed the Tested on Lenovo X1 Carbon This PR has been tested on Lenovo X1 Carbon label Jan 14, 2024
Copy link
Contributor

@mikatammi mikatammi left a comment

Choose a reason for hiding this comment

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

Chromium app test stops working, it seems it's not possible to connect to chromium-vm:

==============================================================================
Test-Suites                                                                   
==============================================================================
Test-Suites.Bat-Tests :: To be executed only for BAT tests                    
==============================================================================
Ghaf version: 24.03
Nixos version: 23.11.20231210.781e2a9 (Tapir)
Test-Suites.Bat-Tests.Apps :: Testing launching applications                  
==============================================================================
Start Chromium on LenovoX1 :: Start Chromium in dedicated VM and v... Connecting to Ghaf Host
Connecting to NetVM
Connecting to gui-vm.ghaf

Starting chromium
Connecting to chromium-vm.ghaf
Killed processes: ['']
| FAIL |
ChannelException: ChannelException(2, 'Connect failed')
------------------------------------------------------------------------------

@josa41
Copy link
Contributor Author

josa41 commented Jan 18, 2024

Chromium app test stops working, it seems it's not possible to connect to chromium-vm:

Fixed, I accidentally cleaned too much of networking code for audio-vm and pulseaudio connection from host to audio-vm was lost in the process.

@leivos-unikie
Copy link
Contributor

Tested these:

  • All apps launch
  • Audio can be controlled from gui-vm
  • ci-test-automation set passes

In performance tests all 1-thread results are at normal level but there are some difference in multi-thread tests compared to ghaf mainline. Probably this is expected when new VMs are introduced.

@leivos-unikie leivos-unikie added the Tested on Lenovo X1 Carbon This PR has been tested on Lenovo X1 Carbon label Jan 19, 2024
Copy link
Contributor

@vilvo vilvo left a comment

Choose a reason for hiding this comment

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

Works functionally, tested again with the latest changes. I see this as an intermediate iteration that enables audio-vm functionality and infrastucture. There are minor issues (pa audio glitches, variables for IP-addresses in audio-vm declaration) but I don't see them blocking. I think the main gain of this PR is that this enables an implemented baseline to discuss and redefine the next gen audio architecture for Ghaf.

@leivos-unikie
Copy link
Contributor

Works functionally, tested again with the latest changes. I see this as an intermediate iteration that enables audio-vm functionality and infrastucture. There are minor issues (pa audio glitches, variables for IP-addresses in audio-vm declaration) but I don't see them blocking. I think the main gain of this PR is that this enables an implemented baseline to discuss and redefine the next gen audio architecture for Ghaf.

Yes, and as Jon earlier noted the playback speed of audio is out of sync. With a 4min youtube video I measured 16% faster playback time compared to external timer.

Initial setup for AudioVM with pulseaudio
- Sound card passthrough to AudioVM
- Appvms use qemu virtual sound card
- Connections over Pulseaudio TCP
- Change volume toggle mute etc working from GuiVM
- Set default max volume level to a bit more reasonable level

Signed-off-by: Jon Sahlberg <[email protected]>
Copy link
Contributor

@leivos-unikie leivos-unikie left a comment

Choose a reason for hiding this comment

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

Integrated speaker/microphone not working. I didn't have now USB headset available but Milla had already tested with that USB headset audio/mic works.

  • Audio/video playback speed. ok
  • ci-test-automation, ok
  • launching apps, ok
  • performance, ok

Initial documentation for Audio virtual machine to separate
the audio data away from host. Audio stream is routed through
host over a virtual sound card to separate the virtual machines
from eachothers audio streams.

Signed-off-by: Jon Sahlberg <[email protected]>
Signed-off-by: Ville Ilvonen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tested on Lenovo X1 Carbon This PR has been tested on Lenovo X1 Carbon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants