Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-05-12 20:35:21 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-05-12 22:52:43 +0300
commit829dce524dbbf34439422cd2906b94ce0e7920ed (patch)
tree88b69699942158d042c89cca66f670602112ec2e /release/freedesktop
parenta5eee1f935a53acba087fae89e5cffc6c37468cd (diff)
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.
Diffstat (limited to 'release/freedesktop')
-rwxr-xr-xrelease/freedesktop/snap/blender-wrapper19
-rw-r--r--release/freedesktop/snap/snapcraft.yaml.in7
2 files changed, 25 insertions, 1 deletions
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