Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add microphone filtering #22

Merged
merged 1 commit into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ services:
- janus
devices:
- "/dev/snd:/dev/snd"
command: gst-launch-1.0 -v alsasrc device=hw:1 ! audioconvert ! audioresample ! opusenc ! rtpopuspay ! queue max-size-bytes=0 max-size-buffers=0 ! udpsink host=127.0.0.1 port=5002
#command: gst-launch-1.0 -v pulsesrc device=microphone ! audioconvert ! audioresample ! opusenc ! rtpopuspay ! queue max-size-bytes=0 max-size-buffers=0 ! udpsink host=127.0.0.1 port=5002
command: "/audio_entry.sh"

fruitnanny:
image: ivadim/fruitnanny-app
restart: always
privileged: true
volumes:
- ./fruitnanny_config.js:/opt/fruitnanny/fruitnanny_config.js
- ./bin:/opt/fruitnanny/bin
network_mode: "host"
depends_on:
- janus
Expand All @@ -61,7 +63,6 @@ services:
volumes:
- ./configuration/nginx/fruitnanny_http:/etc/nginx/conf.d/default.conf
- ./configuration/nginx/fruitnanny_https:/etc/nginx/conf.d/default-ssl.conf
- ./configuration/nginx/.htpasswd:/etc/nginx/.htpasswd
- ./configuration/ssl:/etc/fruitnanny-ssl
ports:
- "80:80"
Expand Down
10 changes: 8 additions & 2 deletions docker/gstreamer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ RUN echo 'APT::Install-Recommends "false";' >/etc/apt/apt.conf.d/00recommends \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly gstreamer1.0-alsa libdc1394-22 libdc1394-utils \
gstreamer1.0-plugins-ugly gstreamer1.0-alsa gstreamer1.0-pulseaudio libdc1394-22 libdc1394-utils \
build-essential meson debhelper autoconf automake libtool pkg-config \
autotools-dev libudev-dev libdc1394-22-dev libraspberrypi-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev git \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev git pulseaudio \
libltdl-dev libcap-dev libsndfile1-dev libdbus-1-dev libspeexdsp-dev \
libasound2-dev libavahi-client-dev avahi-daemon \
&& git clone https://github.com/thaytan/gst-rpicamsrc /tmp/gst-rpicamsrc \
&& cd /tmp/gst-rpicamsrc \
&& git checkout 4ee114fbbf35d85169603aa37678642e9774152a \
Expand All @@ -21,3 +23,7 @@ RUN echo 'APT::Install-Recommends "false";' >/etc/apt/apt.conf.d/00recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*

RUN useradd -rm -d /home/pi -s /bin/bash -g users -G adm,dialout,sudo,audio,video,plugdev,input,netdev -u 1000 pi
COPY audio_entry.sh /
COPY audio_stream.sh /
32 changes: 32 additions & 0 deletions docker/gstreamer/audio_entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env sh

# Copyright (c) 2016, Andrey Arapov
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Dirty workaround until this is fixed:
# Device permissions are broken in 18.02 and 17.12.1 Docker ...
# https://github.com/docker/for-linux/issues/228#issuecomment-370545814
chgrp audio -- /dev/snd/*

# So that dbus-daemon can create /var/run/dbus/system_bus_socket
mkdir /var/run/dbus
dbus-daemon --system --fork

# Avahi-daemon is needed by the PulseAudio's module-zeroconf-publish.
# PulseAudio will talk to the Avahi via the Dbus.
sleep 1
avahi-daemon -D

sleep 1
exec su pi -c "/audio_stream.sh"
5 changes: 5 additions & 0 deletions docker/gstreamer/audio_stream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pulseaudio -D -v --log-target=stderr
pactl load-module module-alsa-source device=hw:1
pactl load-module module-echo-cancel source_name=microphone aec_method=webrtc 'aec_args="analog_gain_control=0 digital_gain_control=0"'
gst-launch-1.0 -v pulsesrc device=microphone ! audioconvert ! audioresample ! opusenc ! rtpopuspay ! queue max-size-bytes=0 max-size-buffers=0 ! udpsink host=127.0.0.1 port=5002