[Bf-blender-cvs] [829dce524db] blender-v2.83-release: Fix T72920: Snap package fails to play audio and blocks audio in other apps
Brecht Van Lommel
noreply at git.blender.org
Tue May 12 21:54:54 CEST 2020
Commit: 829dce524dbbf34439422cd2906b94ce0e7920ed
Author: Brecht Van Lommel
Date: Tue May 12 19:35:21 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB829dce524dbbf34439422cd2906b94ce0e7920ed
Fix T72920: Snap package fails to play audio and blocks audio in other apps
ALSA and OSS are not available for the snap packages, and trying to initialize
them seems to cause some problems for other applications. Instead configure
OpenAL and SDL to use PulseAudio, and set PULSE_SERVER environment variable to
make it work.
===================================================================
A release/freedesktop/snap/blender-wrapper
M release/freedesktop/snap/snapcraft.yaml.in
===================================================================
diff --git a/release/freedesktop/snap/blender-wrapper b/release/freedesktop/snap/blender-wrapper
new file mode 100755
index 00000000000..c116a4c2712
--- /dev/null
+++ b/release/freedesktop/snap/blender-wrapper
@@ -0,0 +1,19 @@
+# Disable ALSA and OSS as they are not available, and trying to initialize them
+# breaks sound in other apps. Use PulseAudio instead.
+export ALSOFT_DRIVERS=-oss,-alsa,
+export SDL_AUDIODRIVER=pulseaudio
+
+# Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR
+# This is adapted from https://github.com/ubuntu/snapcraft-desktop-helpers,
+# in common/desktop-exports.
+mkdir -p $XDG_RUNTIME_DIR -m 700
+if [ -n "$XDG_RUNTIME_DIR" ]; then
+ pulsenative="pulse/native"
+ pulseaudio_sockpath="$XDG_RUNTIME_DIR/../$pulsenative"
+ if [ -S "$pulseaudio_sockpath" ]; then
+ export PULSE_SERVER="unix:${pulseaudio_sockpath}"
+ fi
+fi
+
+# Run Blender
+$SNAP/blender
diff --git a/release/freedesktop/snap/snapcraft.yaml.in b/release/freedesktop/snap/snapcraft.yaml.in
index a79d9ccc0a2..eb3ef97eba8 100644
--- a/release/freedesktop/snap/snapcraft.yaml.in
+++ b/release/freedesktop/snap/snapcraft.yaml.in
@@ -24,7 +24,7 @@ confinement: classic
apps:
blender:
- command: ./blender
+ command: ./blender-wrapper
desktop: ./blender.desktop
version: '@VERSION@'
@@ -46,3 +46,8 @@ parts:
- libxfixes3
- libxrender1
- libxxf86vm1
+ wrapper:
+ plugin: copy
+ source: .
+ files:
+ blender-wrapper: blender-wrapper
More information about the Bf-blender-cvs
mailing list