Skip to content

[Build] PJSUA2 / Asterisk (video-spezifisch) #5

@emphasize

Description

@emphasize

Base: RaspiOS Bulleseye 32-Bit (2022-04-07) + Doorpi (branch bugfix/setuptools)

Da noch nicht im Setupscript verankert hier ein Rezept für eine laufende PJSUA/Asterisk konfiguration

Das ganze stützt sich auf 4 Komponenten:

  • Pjproject
  • SDL
  • Asterisk
  • FFmpeg
    (es wird nur pjproject und openh264 kompiliert)

System Dependenzen:

libtool pkg-config libasound2-dev libpulse-dev libaudio-dev libjack-dev \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \
libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libdbus-1-dev \
libudev-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev \
libzrtpcpp-dev libxext-dev libpcre3-dev libtool libccrtp-dev libdbus-c++-dev libcommoncpp2-dev \
libdbus-1-dev libyaml-dev swig libsamplerate0-dev libspeexdsp-dev libspeex-dev libv4l-dev libx264-dev libcelt-dev \
libgmp3-dev libmpfr-dev libmpfr-doc libmpc-dev libffi-dev libmp3lame-dev libvorbis-dev libtheora-dev yasm nasm \
libopencore-amrwb-dev libopencore-amrnb-dev libvo-amrwbenc-dev libgsm1-dev opus-tools libopus-dev \
libass-dev libfreetype6-dev libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev \
libxcb-xfixes0-dev meson ninja-build texinfo wget zlib1g-dev libsdl2-dev vpx-tools libvpx-dev libvpx6 x264

Swap Anpassung (Kompilierung von pjsua hat eine gewisse ohne die der Prozess abbricht)

#notwendig sind 1.5Gb für (pjsua2) Kompilierung
MINMEM=1572864
SWAP=$(cat /proc/meminfo | grep SwapTotal | awk '{print $2}')
MEM=$(cat /proc/meminfo | grep MemTotal | awk '{print $2}')
TOTALMEM=$(expr $SWAP + $MEM)
if [ $TOTALMEM -lt $MINMEM ] ; then
   sudo dphys-swapfile swapoff
   SWAPNEEDED=$(expr $(expr $MINMEM - $MEM) / 1000)
   sudo sed -i "s/CONF_SWAPSIZE=.*/CONF_SWAPSIZE=${SWAPNEEDED}/g" /etc/dphys-swapfile
   sudo dphys-swapfile setup
   sudo dphys-swapfile swapon
   sudo reboot
fi
O264_PACKAGE="v2.2.0.tar.gz"
PJSIP_PACKAGE="2.12.tar.gz"
O264_VER=$(echo ${O264_PACKAGE%".tar.gz"} | cut -c 2-)
PJSIP_VER=${PJSIP_PACKAGE%".tar.gz"}

Openh264

cd ~ && wget https://github.com/cisco/openh264/archive/refs/tags/${O264_PACKAGE} && tar xvfz ${O264_PACKAGE} && cd openh264-${O264_VER} 
make -j`nproc` && sudo make install
cd ~ && rm -rf openh264-${O264_VER} && rm ${O264_PACKAGE}
sudo ldconfig

Pjproject

cd ~
wget https://github.com/pjsip/pjproject/archive/refs/tags/${PJSIP_PACKAGE}
tar xvfz ${PJSIP_PACKAGE} && cd pjproject-${PJSIP_VER}
echo '#define PJMEDIA_AUDIO_DEV_HAS_ALSA      1
#define PJMEDIA_AUDIO_DEV_HAS_PORTAUDIO 0
#define PJMEDIA_HAS_VIDEO       1' > pjlib/include/pj/config_site.h
Raspberry Pi -mtune -mfpu -march
Zero /1 A+/1 B+ arm1176jzf-s vfp armv6
2 B cortex-a7 neon-vfpv4 armv7
3 B cortex-a53 neon-vfpv4 armv7
3 B+ /4 B cortex-a72 neon-fp-armv8 armv8

vielleicht noch einmal genauer nachschauen, da es in jeder Generation zwischenmodelle gibt

echo "export CFLAGS += -march=armv7 -mtune=cortex-a53 -mfpu=neon-vfpv4 -mfloat-abi=hard -mlittle-endian -munaligned-access 
-ffast-math
export LDFLGS +=" > user.mak
nano third_party/build/os-auto.mak.in

Die webrtc sektion mit folgender überschreiben:

ifneq (@ac_no_webrtc@,1)
ifeq (@ac_external_webrtc@,1)
# External webrtc
else
DIRS += webrtc
WEBRTC_OTHER_CFLAGS = -fexceptions -DWEBRTC_POSIX=1 @ac_webrtc_cflags@
#ifneq ($(findstring sse2,@ac_webrtc_instset@),)
#    WEBRTC_SRC = \
#             modules/audio_processing/aec/aec_core_sse2.o               \
#             modules/audio_processing/aec/aec_rdft_sse2.o               \
#             modules/audio_processing/aecm/aecm_core_c.o                \
#             modules/audio_processing/ns/nsx_core_c.o                   \
#             system_wrappers/source/cpu_features.o
#else ifneq ($(findstring neon,@ac_webrtc_instset@),)
    WEBRTC_SRC = \
              modules/audio_processing/aec/aec_core_neon.o               \
              modules/audio_processing/aec/aec_rdft_neon.o               \
              modules/audio_processing/aecm/aecm_core_c.o                \
              modules/audio_processing/aecm/aecm_core_neon.o             \
              modules/audio_processing/ns/nsx_core_c.o                   \
              modules/audio_processing/ns/nsx_core_neon.o                \
              common_audio/signal_processing/cross_correlation_neon.o    \
              common_audio/signal_processing/downsample_fast_neon.o      \
              common_audio/signal_processing/min_max_operations_neon.o
    WEBRTC_OTHER_CFLAGS += -DWEBRTC_HAS_NEON
#else ifneq ($(findstring mips,@ac_webrtc_instset@),)
#    WEBRTC_SRC = \
#              modules/audio_processing/aec/aec_core_mips.o               \
#             modules/audio_processing/aec/aec_rdft_mips.o               \
#             modules/audio_processing/aecm/aecm_core_mips.o             \
#             modules/audio_processing/ns/nsx_core_mips.o                \
#             common_audio/signal_processing/cross_correlation_mips.o    \
#             common_audio/signal_processing/downsample_fast_mips.o      \
#             common_audio/signal_processing/min_max_operations_mips.o
#
#    WEBRTC_OTHER_CFLAGS += -DMIPS_FPU_LE
#else # Generic fixed point
#    WEBRTC_SRC = \
#             modules/audio_processing/aecm/aecm_core_c.o                \
#             modules/audio_processing/ns/nsx_core_c.o                   \
#             common_audio/signal_processing/complex_fft.o
#endif
endif
endif
./configure --enable-shared
make dep && make -j`nproc`
sudo make install
cd pjsip-apps/src/swig/python
make
sudo pip install .
cd ~ && sudo rm -rf pjproject-${PJSIP_VER} && rm ${PJSIP_PACKAGE}
sudo ldconfig

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions