termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.09k stars 3k forks source link

[Bug]: PulseAudio not working on 32bit Android #21660

Open T-vK opened 1 day ago

T-vK commented 1 day ago

Problem description

On 32bit arm Android devices, PulseAudio does not appear to work properly. I'm trying to load module-sles-source in order to access the microphone.

Some people suggest setting LD_PRELOAD=/system/lib64/libskcodec.so or LD_LIBRARY_PATH=/system/lib64/, but /system/lib64/ does apparently not exist on 32bit arm and /system/lib/ does not contain any library called libskcodec.so.

What steps will reproduce the bug?

Run this on an Android device with an arm (as opposed to aarch64) CPU:

pkg up
pkg install termux-api pulseaudio
# Trigger mic permission prompt (Make sure you also have Termux:API app isntalled):
termux-microphone-record -f ./tmp.wav && termux-microphone-record -q && rm ./tmp.wav 
pactl load-module module-sles-source

The last command throws:

shared memfd open() failed: Unknown error 38

What is the expected behavior?

The expected behavior is that

pactl load-module module-sles-source

doesn't throw any errors and only returns a module id.

And after that, this command:

pactl list short sources

Should return at least one microphone (and not just a sink monitor).

System information

The device is an Amazon Fire HD 7 Tablet running LineageOS 14:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=2913
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.1
TERMUX__USER_ID=0
Packages CPU architecture:
arm
Subscribed repositories:
# sources.list
deb https://mirror.mwt.me/termux/main stable main
Updatable packages:
All packages up to date
termux-tools version:
1.43.5
Android version:
7.1.2
Kernel build information:
Linux localhost 3.10.108+ #1 SMP PREEMPT Wed Aug 28 09:32:02 BST 2019 armv7l Android
Device manufacturer:
amzn
Device model:
Fire
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api
com.termux.boot
licy183 commented 19 hours ago

Your kernel doesn't have memfd support, but it is neccessay for PulseAudio to work properly.

T-vK commented 15 hours ago

@licy183 Thank you, that's very valuable information to me. Do you happen to have some insight on that? Is there a specific kernel version that introduced it in its core or is there a module that provides this functionality?

Biswa96 commented 13 hours ago

There is no official LineageOS support for Amazon Fire Tablet https://wiki.lineageos.org/devices/

licy183 commented 4 hours ago

I'm afraid that this will not be fixed in the main repository, as memfd should be available on Android 7.x.

I've pushed a commit that drops the memfd usage in pulseaudio. You can download the debs in https://github.com/termux/termux-packages/actions/runs/11190633201 and test if it works.