I’m trying to use QAudioDecoder in a snap, I get “Playbin element is not valid” error. See source of qgstreameraudiodecodersession.cpp

The only thing in the syslog corresponding to this is:
kernel: [ 7832.904965] audit: type=1326 audit(1625711895.215:281): auid=1000 uid=1000 gid=1000 ses=4 subj=snap.amp-waver.waver pid=9014 comm="decoder" exe="/snap/amp-waver/x1/opt/waver/bin/waver" sig=0 arch=c000003e syscall=314 compat=0 ip=0x7f496189489d code=0x50000

confinement: strict
base: core20
audio-playback plug is connected and works
The app compiles without a problem.

In an attempt to resolve the problem, I added all the gstreamer and codec packages I could think of to stage-packages:
- freeglut3
- gir1.2-gst-plugins-base-1.0
- gir1.2-gstreamer-1.0
- gstreamer1.0-alsa
- gstreamer1.0-clutter-3.0
- gstreamer1.0-gl
- gstreamer1.0-gtk3
- gstreamer1.0-libav
- gstreamer1.0-packagekit
- gstreamer1.0-vaapi
- gstreamer1.0-x
- gstreamer1.0-pulseaudio
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- gstreamer1.0-plugins-bad
- gstreamer1.0-plugins-ugly
- libqt5core5a
- libqt5dbus5
- libqt5gui5
- libqt5keychain1
- libqt5multimedia5
- libqt5multimedia5-plugins
- libqt5multimediagsttools5
- libqt5network5
- libqt5qml5
- libqt5quick5
- libqt5quick5-gles
- libqt5quickcontrols2-5
- libqt5sql5-sqlite
- libqt5xml5
- libavcodec58
- libavcodec-extra
- libavcodec-extra58
- libavdevice58
- libavfilter7
- libavformat58
- libavresample4
- libavutil56
- libcodec2-0.9
- libpostproc55
- libswresample3
- libswscale5
- libglu1-mesa
- libgstreamer1.0-0
- libgstreamer-gl1.0-0
- libgstreamer-plugins-base1.0-0
- libgstreamer-plugins-bad1.0-0
- libgstreamer-plugins-good1.0-0
- libpulse0
- libssh2-1
- libtag1v5
- qml-module-qtquick2
- qml-module-qtquick-controls2
- qml-module-qtquick-layouts
- qml-module-qtquick-window2
- qt5-image-formats-plugins
But to no avail.

The app works in classic confinement.

Any help would be greatly appreciated.

have you tried installing the snappy-debug snap and running the snappy-debug command in a second terminal while running your app ? that might give some suggestions about the denials …

Thanks for the suggestion. snappy-debug recommended to add the process-control plug, which I did, and connected it manually. Unfortunately, the error still persists.

hmm, connecting the interface should have made the error vanish from syslog, this is weird as process-control clearly allows sched_setattr (which is syscall 314 (on x86 at least))

Double checked it, you’re absolutely right, that error is not in syslog anymore. However, audio decoding still fails, the “Playbin element is not valid” error persists.

ah, good, so the snap confinement should not be in your way anymore at least … you could try to strace it at runtime (using snap run --strace ...). probably it expects some files, configs libs etc in different places than your snap provides or some such (you could use layouts to re-map that) … also make sure you have a pulseaudio daemon running the snap can connect to …

Finally I had time to sort this out. The solution, as usual, was something trivial: GST_PLUGIN_PATH must be set.

For future reference, the key to figure out the problem was to temporary set GST_DEBUG=5 in my wrapper script.

Thank you @ogra for the help with finding the required plugs.

1 Like