diff --git a/pi/asound.conf b/pi/asound.conf index 5cb01c17..1f542df5 100644 --- a/pi/asound.conf +++ b/pi/asound.conf @@ -11,10 +11,21 @@ pcm.softvol { } } +# Shareable mic capture on the Google Voice HAT (card 0) +pcm.micdup { + type dsnoop + ipc_key 2048 + slave { + pcm "hw:0,0" + channels 1 + rate 16000 + } +} + # Define a software volume (gain) for the microphone (Capture) pcm.micboost { type softvol - slave.pcm "dsnoop" # route through dsnoop for sharing + slave.pcm "micdup" # route through dsnoop wrapper control { name "Micro" # name of mic gain control card 0 diff --git a/pi/bin/video-publisher.sh b/pi/bin/video-publisher.sh index 277e3b2d..d1a9fa58 100644 --- a/pi/bin/video-publisher.sh +++ b/pi/bin/video-publisher.sh @@ -50,7 +50,8 @@ FLIP_ARGS=(--rotation 180) run_pipeline() { if [[ "${AUDIO_ENABLE}" -eq 1 ]]; then - "${LIBCAMERA_BIN_PATH}" \ + # Try audio + video; if audio device is missing, fallback to video-only. + if ! "${LIBCAMERA_BIN_PATH}" \ --inline \ --timeout 0 \ --width "${VIDEO_WIDTH}" \ @@ -85,7 +86,13 @@ run_pipeline() { -flush_packets 1 \ -f mpegts \ "${PUBLISH_URL}" - else + then + echo "Audio pipeline failed; falling back to video-only this run" >&2 + AUDIO_ENABLE=0 + fi + fi + + if [[ "${AUDIO_ENABLE}" -ne 1 ]]; then "${LIBCAMERA_BIN_PATH}" \ --inline \ --timeout 0 \