GithubHelp home page GithubHelp logo

Extending Deepin apricot docker image for sound support with x11docker's corresponding options. about dockerfile-x11docker-deepin HOT 23 CLOSED

mviereck avatar mviereck commented on September 22, 2024
Extending Deepin apricot docker image for sound support with x11docker's corresponding options.

from dockerfile-x11docker-deepin.

Comments (23)

mviereck avatar mviereck commented on September 22, 2024

Dependencies in general are listed in the wiki: https://github.com/mviereck/x11docker/wiki/dependencies#dependencies-of-feature-options

For pulseaudio sound you need libpulse0, for ALSA there are no dependencies.

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

OK. See my following testing and results.

In install the possible dependencies both on host and client:

$ sudo apt-get install libpulse0 pulseaudio

  1. For using pulseaudio, --pulseaudio, --pulseaudio=tcp, or --pulseaudio=socket will do the trick.

  2. For using alsa. I still can't figure out how to set the corresponding option. See the output of aplay -l:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC888-VD Analog [ALC888-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: ALC888-VD Digital [ALC888-VD Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 12: HDMI 6 [HDMI 6]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

For my case, the USB audio device is in using and I pass the following option to x11docker but still failed:

--alsa='card 2'

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

Try --alsa=2 or --alsa=Device. (Either the number before : or the name behind : ).
This just sets environment variable ALSA_CARD in container.

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

Try --alsa=2 or --alsa=Device.

Neither can do the trick. With these options, the bottom toolbar will twist/disappear in the container of Deepin desktop.

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

Neither can do the trick.

Check the output of aplay -l in container.

With these options, the bottom toolbar will twist/disappear in the container of Deepin desktop.

deepin crashes? Than rather use --pulseaudio.

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

Neither can do the trick.

Check the output of aplay -l in container.

werner@X10DAi:~/Desktop$ aplay -l
**** List of PLAYBACK Hardware Devices ****
XDG_RUNTIME_DIR (/tmp/XDG_RUNTIME_DIR) is not owned by us (uid 1000), but by uid 0! (This could e g happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
card 0: PCH [HDA Intel PCH], device 0: ALC888-VD Analog [ALC888-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: ALC888-VD Digital [ALC888-VD Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 12: HDMI 6 [HDMI 6]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

With these options, the bottom toolbar will twist/disappear in the container of Deepin desktop.

deepin crashes?

The desktop can be started, but the bottom toolbar will disappear and the sound card doesn't take effect.

Than rather use --pulseaudio.

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

The desktop can be started, but the bottom toolbar will disappear and the sound card doesn't take effect.

I'd assume, if the bottom toolbar disappears, you cannot start anything to check the card.
Try something different than deepin desktop to check the alsa option.

The output of aplay -l is the same as on host, that looks good.

If you want to investigate the crash of the toolbar, run x11docker with -V. There will be lots of output, but maybe you'll find a hint.

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

I'd assume, if the bottom toolbar disappears, you cannot start anything to check the card.

The terminal works as usual which can be used to debug problems.

If you want to investigate the crash of the toolbar, run x11docker with -V. There will be lots of output, but maybe you'll find a hint.

Even I don't use -V, the log on stdout printed by x11docker will refresh/repeat for ever when using alsa as noted previously.

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

The terminal works as usual which can be used to debug problems.

I've checked with terminal only, --alsa=2 just works.

the log on stdout printed by x11docker will refresh/repeat for ever when using alsa as noted previously.

Just checked here, I can reproduce the issue. Is fixed now.

Sound with --alsa using deepin desktop still fails. It seems to be a pulseaudio issue that is started by deepin.
It seems pulseaudio somehow fails to use the alsa device files.
I have no idea how to fix this.
--alsa with deepin desktop works if I add --runasroot "rm /usr/bin/pulseaudio" to brutally avoid the start of pulseaudio at all.
It should be enough to remove /etc/xdg/autostart/pulseaudio.desktop, but pulseaudio is started nonetheless.

I recommend to just use --pulseaudio for deepin.

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

Thanks a lot for you systematic analysis.

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

I found a solution:
With --alsa x11docker now sets up a pulseaudio config file that disables the autostart of pulseaudio. Now the alsa sound works in deepin desktop, too.
Though, a nicer solution would have been to fix the pulseaudio issue itself so that it uses the alsa device files /dev/snd in container.

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

Tried again but the problem still exists for my case. Though the bottom toolbar appears as usual, but the sound setting button doesn't appear on it. Furthermore, the aplay -l command in container will take more than 10sec to complete:

$ time aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC888-VD Analog [ALC888-VD Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: ALC888-VD Digital [ALC888-VD Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 12: HDMI 6 [HDMI 6]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

real    0m10.029s
user    0m0.009s
sys     0m0.009s

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

Tried again but the problem still exists for my case.

Please check if the sound itself works. That is different from possible deepin issues. Check with speaker-test in terminal.

the sound setting button doesn't appear on it.

The button would need pulseaudio. deepin seems not to be designed to use ALSA only.

Furthermore, the aplay -l command in container will take more than 10sec to complete:

Odd.

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

Please check if the sound itself works. That is different from possible deepin issues. Check with speaker-test in terminal.

The testing succeeded on host but failed in container as shown below:

werner@X10DAi:~/Desktop$ speaker-test

speaker-test 1.1.8

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
Playback open error: -2,No such file or directory

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

Please check the following command on host and in container to make sure the same card is used:

env ALSA_CARD=2 speaker-test

At first check with deepin-terminal only instead of running the entire desktop in container.

x11docker --alsa=2 x11docker/deepin deepin-terminal

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

This way, the testings will succeed both on host and in container:

werner@adf40ae74f51:~$ env ALSA_CARD=2 speaker-test

speaker-test 1.1.8

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 2048 to 16384
Period size range from 1024 to 1024
Using max buffer size 16384
Periods = 4
was set period_size = 1024
was set buffer_size = 16384
 0 - Front Left
Time per period = 2.662493
 0 - Front Left
Time per period = 2.966100
 0 - Front Left
Time per period = 3.007849
 0 - Front Left
Time per period = 2.986010
 0 - Front Left
^CWrite error: -4,Interrupted system call
xrun_recovery failed: -4,Interrupted system call
Transfer failed: Interrupted system call

So, presumably, it's some option(s) used by me that cause the problem.

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

This way, the testings will succeed both on host and in container:

Good! Than check:

x11docker --alsa=2 x11docker/deepin deepin-terminal

In container:

echo $ALSA_CARD
speaker-test

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

Still succeed and the $ALSA_CARD has value of 2 in the container which is expected.

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

Good! Is any issue left?

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

In --desktop mode, the above testing still succeed. Though the menu entry/button for the sound card can't be listed, I still can't use it in app, say, wechat.

That said, the problem is solved/fixed basically. From the use experience point of view, it seems the --pulseaudio based method is more convenient and efficient.

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

In --desktop mode, the above testing still succeed.

Good. So from an x11docker point of view, the issue is fixed.

Though the menu entry/button for the sound card can't be listed

That is a deepin issue that expects pulseaudio. For sound control you would need some ALSA frontend.

I still can't use it in app, say, wechat.

Likely wine needs a configuration to use ALSA.

From the use experience point of view, it seems the --pulseaudio based method is more convenient and efficient.

Yes. deepin is entirely designed to use pulseaudio.

from dockerfile-x11docker-deepin.

hongyi-zhao avatar hongyi-zhao commented on September 22, 2024

I still can't use it in app, say, wechat.

Sorry for my typo. I should have typed as below:

I still can use it in app, say, wechat.

Likely wine needs a configuration to use ALSA.

from dockerfile-x11docker-deepin.

mviereck avatar mviereck commented on September 22, 2024

Good, than all is well.

from dockerfile-x11docker-deepin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.