thestr4ng3r / chiaki

Moved to https://git.sr.ht/~thestr4ng3r/chiaki - Free and Open Source PS4 Remote Play Client
https://git.sr.ht/~thestr4ng3r/chiaki
2.17k stars 373 forks source link

No audio on RPi4 #397

Closed domb84 closed 3 years ago

domb84 commented 3 years ago

Environment

Describe the bug No audio output. Appears to try to use pulseaudio when I'm using alsa. Installed pulseaudio as well, error no longer appears but still no audio output.

To Reproduce Steps to reproduce the behavior:

Built as follows:
# install dependencies
sudo apt install cmake python3-protobuf protobuf-compiler libopus-dev libsdl2-dev libssl-dev qttools5-dev libqt5svg5-dev qtmultimedia5-dev libqt5multimedia5-plugins gstreamer-qapt qt5* -y

# clone rpi branch of chiaki
cd /home/pi
git clone https://github.com/thestr4ng3r/chiaki chiaki
cd chiaki
git submodule update --init

# build
mkdir build
cd build
cmake ..
make

session launches without issue, no audio.

Expected behavior Audio to output

Log Files

qt.qpa.input: libinput: event0  - debounce state: DEBOUNCE_STATE_RELEASED → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_UP
qt.qpa.input: libinput: event0  - debounce state: DEBOUNCE_STATE_IS_UP → DEBOUNCE_EVENT_PRESS → DEBOUNCE_STATE_DOWN_WAITING
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/arm-linux-gnueabihf/qt5/plugins/audio" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/arm-linux-gnueabihf/qt5/plugins/audio/libqtaudio_alsa.so"
Found metadata in lib /usr/lib/arm-linux-gnueabihf/qt5/plugins/audio/libqtaudio_alsa.so, metadata=
{
    "IID": "org.qt-project.qt.audiosystemfactory/5.0",
    "MetaData": {
        "Keys": [
            "alsa"
        ]
    },
    "className": "QAlsaPlugin",
    "debug": false,
    "version": 330499
}

Got keys from plugin meta data ("alsa")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/arm-linux-gnueabihf/qt5/plugins/audio/libqtmedia_pulse.so"
Found metadata in lib /usr/lib/arm-linux-gnueabihf/qt5/plugins/audio/libqtmedia_pulse.so, metadata=
{
    "IID": "org.qt-project.qt.audiosystemfactory/5.0",
    "MetaData": {
        "Keys": [
            "default"
        ]
    },
    "className": "QPulseAudioPlugin",
    "debug": false,
    "version": 330499
}

Got keys from plugin meta data ("default")
QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/chiaki/build/gui/audio" ...
loaded library "/usr/lib/arm-linux-gnueabihf/qt5/plugins/audio/libqtmedia_pulse.so"
PulseAudioService: pa_context_connect() failed
qt.qpa.input: libinput: event0  - debounce state: DEBOUNCE_STATE_DOWN_WAITING → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_DOWN
qt.qpa.input: libinput: client bug: timer event0 debounce: offset negative (-147ms)
qt.qpa.input: libinput: client bug: timer event0 debounce short: offset negative (-160ms)
qt.qpa.input: libinput: event0  - debounce state: DEBOUNCE_STATE_IS_DOWN → DEBOUNCE_EVENT_RELEASE → DEBOUNCE_STATE_RELEASE_WAITING
qt.qpa.input: libinput: event0  - debounce state: DEBOUNCE_STATE_RELEASE_WAITING → DEBOUNCE_EVENT_TIMEOUT_SHORT → DEBOUNCE_STATE_RELEASED
qt.qpa.input: libinput: event0  - debounce state: DEBOUNCE_STATE_RELEASED → DEBOUNCE_EVENT_TIMEOUT → DEBOUNCE_STATE_IS_UP
[I] Discovery Service detected new host with id F8461C7E45AF
[I] Logging to file /home/pi/.local/share/Chiaki/Chiaki/log/chiaki_session_2020-12-08_22-02-32-361361.log
[I] Chiaki Version 1.3.0
[I] Raspberry Pi Decoder initialized
[I] Controller 0 opened: "X360 Controller"
[I] Starting session request

[I] StreamConnection successfully received bang
[I] Crypt has become available. Re-checking MACs of 0 packets
ESC[38;5;34m[D] ESC[0mStreamConnection received audio header:
ESC[38;5;34m[D] ESC[0moffset 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
ESC[38;5;34m[D] ESC[0m     0 02 10 00 00 bb 80 00 00 01 e0 00 00 00 01       ..............
[I] Audio Header:
[I]   channels = 2
[I]   bits = 16
[I]   rate = 48000
[I]   frame size = 480
[I]   unknown = 1
[I] ChiakiOpusDecoder initialized
ESC[38;5;31m[E] ESC[0mAudio Format with 2 channels @ 48000 Hz not supported by Audio Device
[I] Video Profiles:
[I]   0: 1280x720
[I] StreamConnection successfully received streaminfo

Screenshots n/a

Additional context Add any other context about the problem here.

domb84 commented 3 years ago

Also tried building using information from this post...

https://github.com/thestr4ng3r/chiaki/issues/126#issuecomment-714834183

However chiaki fails to launch at all unless set to -platform minimal (then no GUI output)

domb84 commented 3 years ago

Resolved this in the end...

apt install pulseaudio
echo "snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_compat_alsa=1" >> /boot/cmdline.txt

https://retropie.org.uk/forum/topic/26628/audio-issues-after-latest-raspbian-updates

Fredrum commented 3 years ago

Like mentioned over on RetroPie, I just tested my build after having done a Raspian OS update to get the new PulseAudio default setup. It just works and I didn't have to change anything on the Chiaki side of things. 'Default' setting in the Chiaki Audio device menu still works, whether you're using Alsa or PulseAudio.

Note that Iv'e so far had to build using the Qt5.12 .deb package. Otherwise the Audio devices don't list and that menu will end up empty.

Though one user here said that sound was working with vanilla apt Qt. I haven't managed to get that though.