MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.18k stars 351 forks source link

output/snapcast: Snapcast Android app does not play sound #1095

Closed skidoo23 closed 3 years ago

skidoo23 commented 3 years ago

Bug report

Describe the bug

Android Snapcast app 0.23 from Google Play Store connects to MPD server if

  1. App setting Host: x.x.x.x (no zeroconf available) stream port: 1704 control port: 1704

  2. mpd.conf audio_output { type "snapcast" name "SnapCast (Network)" format "48000:16:2" }

Successful connection is made but no sound. Commandline snapclient 0.23 on same hardware as MPD works on ALSA output.

Expected Behavior

Play sound on Snapcast Android client app. Accept default values.

Actual Behavior

No sound on Snapcast Android client app. Manual configuration changes required.

Version

mpd --version Music Player Daemon 0.23~git (v0.22.6-246-gc729f16dc) Copyright 2003-2007 Warren Dukes warren.dukes@gmail.com Copyright 2008-2018 Max Kellermann max.kellermann@gmail.com This is free software; see the source for copying conditions. There is NO warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins: simple proxy

Storage plugins: local udisks curl

Neighbor plugins: udisks

Decoders plugins: [mad] mp3 mp2 [mpg123] mp3 [vorbis] ogg oga [oggflac] ogg oga [flac] flac [opus] opus ogg oga [dsdiff] dff [dsf] dsf [hybrid_dsd] m4a [faad] aac [mpcdec] mpc [wavpack] wv [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve rtp:// rtsp:// rtsps:// [pcm]

Filters: libsamplerate soxr

Tag plugins: id3tag

Output plugins: null fifo pipe alsa httpd snapcast recorder

Encoder plugins: null vorbis opus lame wave flac

Archive plugins: [bz2] bz2 [zzip] zip

Input plugins: file io_uring archive alsa curl ffmpeg

Playlist plugins: extm3u m3u pls xspf asx rss flac cue embcue

Protocols: file:// alsa:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mmsh:// mmst:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp://

Other features: avahi dbus udisks epoll icu inotify systemd tcp un

Log

mpd --stderr --no-daemon --verbose

config_file: loading file /etc/mpd.conf libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator' vorbis: Xiph.Org libVorbis 1.3.7 opus: libopus 1.3.1 hybrid_dsd: The Hybrid DSD decoder is disabled because it was not explicitly enabled simple_db: reading DB curl: version 7.74.0 curl: with GnuTLS/3.7.0 avahi: Initializing interface avahi: Client changed to state 101 avahi: Client is CONNECTING state_file: Loading state file /var/lib/mpd/state exception: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted playlist: queue song 3:"C/Client Liaison - Diplomatic Immunity (Album)/08 The Bravest Begginings.mp3" inotify: initializing inotify decoder_thread: probing plugin mad decoder: audio_format=44100:24:2, seekable=true exception: OutputThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted output: opened "SnapCast (Network)" (snapcast) audio_format=48000:16:2 libsamplerate: setting samplerate conversion ratio to 1.09 output: converting in=44100:24:2 -> f=44100:24:2 -> out=48000:16:2 replay_gain: replay gain mode has changed off->album replay_gain: scale=1.000000 inotify: watching music directory

... no other output if Android client connects.

MaxKellermann commented 3 years ago

You're using it wrong (and the Android app is, due to a misdesign, incapable of talking to MPD). You told the app to use the stream port as control port, but that doesn't work. The control port is a JSON-L based protocol, while the stream port is for the binary protocol (https://github.com/badaix/snapcast/blob/master/doc/binary_protocol.md). MPD implements only the latter. You can't use the binary protocol as control port. That just doesn't work. Now the app is misdesigned because it refuses to work without that control connection. Sorry, can't help with that - the app needs to be fixed.