How to tackle down 100% CPU-Load with MPD?

Hi @ all

I want to set up a "radio" server on my OpenWrt-23.05.0-rc2 powered NSA325 to serve some music files to my fritzfon. The problem is that phone accepts only an MP3 stream with a playlist formatted as pls or m3u so ices is out. I've tried with mpd-full and it's own http server - with no real luck - I hope yet.

I can connect with mpc remotely, can initiate some playing wich opens the corresponding port - that gives according to top some CPU peaks up to 5% on mpd - but as soon as I connect some "listening device" such as firefox to that port the sound is playing with gaps and the CPU-Load skyrockets to 100% with average usage of 99%. Same with the phone, at least it plays that music somehow.

To solve that I've tried at first to set fixed format, somewhrere I read that the fritzfon wants 44,1kHz, 128kbit/s Sterero as it's format so I reformatted my test mp3 with theese settings - no luck. Then I tried everything I stumbled across which might reduce the need for recompiling the stream on the fly - no luck. Then I tried if an other format at least solve the issue in the browser, just to see if lame is to blame - with vorbis as encoder (and of course an ogg test file) it's much worse. With the flac encoder it works in the browser with ~ 23% CPU peak, heavily fluctuating - but that format isn't recognized by the phone. Now I'm running out of ideas what to do and how to solve this, at least to get to the root cause of that behavior. Have you any ideas?

My actual /etc/mpd.conf:

# Music Player Daemon 0.23.13

music_directory		"/mnt/md0/media/radio"
follow_outside_symlinks	"yes"
# follow_inside_symlinks	"yes"

database {
	plugin		"simple"
	path		"/mnt/md0/media/mpd/database"
#	cache_directory	"/mnt/md0/media/mpd/cache"
}

input {
	plugin		"file"
}

audio_output {
	type		"httpd"
	name		"RadioStream for FritzFon"
#	format		"44100:32:2"
#	always_on	"yes"
#	tags		"yes"
	mixer_type	"none"
	reply_gain_handler	"none"
	bind_to_address	"0.0.0.0"
	port		"8000"
#	max_clients	"0"
#	encoder		"null"
	encoder		"lame"		### If listening CPU-Load goes to 100% with clipping, "only playing" is fine.
		bitrate	"128"
#	encoder		"vorbis"	### Worse! More Silence due to clipping than playing.
#		bitrate	"128"
#	encoder		"flac"		### Plays, CPU peak ~23%, not supported by fritzfon.
#	encoder		"wave"		### No files listed in MPC.
}
resampler {
	plugin		"internal"	### No change with MP3.
#	plugin		"soxr"
#	quality		"low"		### No change with MP3 to "High"
#	quality		"quick"		### No change with MP3 to "High"
}

bind_to_address		"0.0.0.0"
# bind_to_address		"any"
# port			"6600"
default_permissions	"read"
host_permissions	"192.168.1.90 read,add,control,admin"
state_file		"/mnt/md0/media/mpd/state"
# restore_paused	"no"

playlist_directory	"/mnt/md0/media/playlists"
pid_file		"/var/run/mpd.pid"
log_level		"verbose"
auto_update		"yes"

The output of top with mpd playing but noone recieving the stream, filtered to the user "mpd":

top - 17:28:29 up 93 days, 21:48,  0 users,  load average: 0.00, 0.01, 0.00
Tasks:  70 total,   1 running,  69 sleeping,   0 stopped,   0 zombie
%Cpu0  :  2.3 us,  0.2 sy,  0.0 ni, 97.5 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    498.2 total,     20.9 free,     28.9 used,    448.4 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.    393.4 avail Mem 

  PID USER      PR  NI    VIRT    RES  %CPU  %MEM     TIME+ S COMMAND                                                        
 3628 mpd       10 -10   24.5m  12.1m   2.6   2.4   4:13.01 S  `- /usr/bin/mpd --no-daemon /etc/mpd.conf                     

Same with firefox recieving the stream:

top - 17:34:10 up 93 days, 21:54,  0 users,  load average: 0.34, 0.09, 0.03
Tasks:  72 total,   1 running,  71 sleeping,   0 stopped,   0 zombie
%Cpu0  : 99.1 us,  0.6 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.3 si,  0.0 st
MiB Mem :    498.2 total,     20.9 free,     28.8 used,    448.5 buff/cache
MiB Swap:      0.0 total,      0.0 free,      0.0 used.    393.4 avail Mem 

  PID USER      PR  NI    VIRT    RES  %CPU  %MEM     TIME+ S COMMAND                                                        
 3628 mpd       10 -10   24.5m  12.0m  99.8   2.4   4:37.59 S  `- /usr/bin/mpd --no-daemon /etc/mpd.conf                     

If I stop mpd playing it settles down to 0.0 % CPU as expected.

Best regards
Peter