lintweaker / mpd-dsd-019

DSD specific patches for MPD 0.19
GNU General Public License v2.0
10 stars 4 forks source link

MPD 0.19.12- 0.19.13 Crash During playback DSD128 in Native Mode #18

Closed norrest closed 8 years ago

norrest commented 8 years ago

Bad news ( I have some files dsd128 Album Roger Waters - Amused To Death_Stig_DSD A1.The Ballad Of Bill Hubbard.dff A2.What God Wants Part I.dff ...................... At the end of the first - the counter do not stops and the next track do not starts to play!!!! In this moment CPU LOAD 99% -100 % and in log`s have "sched: RT throttling activated" Kernel 4.4.3 and try 4.4.4 now! Help only kill -9 and restart service!

I thought that the problem is global, but as it turned out at the last moment, just when activated DSD_Native = On

` 0 [Audio ]: USB-Audio - Ustars Audio Ustars Audio at usb-1c1c000.usb-1, high speed 2: [ 0] : control 3: [ 0- 0]: digital audio playback 33: : timer 0 snd_usb_audio 00-00: USB Audio : USB Audio : playback 1 G0: system timer : 1000.000us (10000000 ticks) P0-0-0: PCM playback 0-0-0 : SLAVE Advanced Linux Sound Architecture Driver Version k4.4.4. Audio Ustars Audio at usb-1c1c000.usb-1, high speed : USB Audio

Playback: Status: Stop Interface 1 Altset 1 Format: S32_LE Channels: 2 Endpoint: 1 OUT (ASYNC) Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000 Data packet interval: 125 us Interface 1 Altset 2 Format: SPECIAL DSD_U32_BE Channels: 2 Endpoint: 1 OUT (ASYNC) Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000 Data packet interval: 125 us Interface 1 Altset 3 Format: S32_LE Channels: 2 Endpoint: 1 OUT (ASYNC) Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000 Data packet interval: 125 us 002/002 20b1:2012 USB Mixer: usb_id=0x20b12012, ctrlif=0, ctlerr=0 Card: Ustars Audio at usb-1c1c000.usb-1, high speed Unit: 10 Control: name="Ustars Audio Output Playback Volume", index=1 Info: id=10, control=2, cmask=0x0, channels=1, type="S16" Volume: min=-32512, max=0, dBmin=-12700, dBmax=0 Unit: 10 Control: name="Ustars Audio Output Playback Volume", index=0 Info: id=10, control=2, cmask=0x3, channels=2, type="S16" Volume: min=-32512, max=0, dBmin=-12700, dBmax=0 Unit: 10 Control: name="Ustars Audio Output Playback Switch", index=1 Info: id=10, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN" Volume: min=0, max=1, dBmin=0, dBmax=0 Unit: 10 Control: name="Ustars Audio Output Playback Switch", index=0 Info: id=10, control=1, cmask=0x3, channels=2, type="INV_BOOLEAN" Volume: min=0, max=1, dBmin=0, dBmax=0 card: 0 device: 0 subdevice: 0 stream: PLAYBACK id: USB Audio name: USB Audio subname: subdevice #0 class: 0 subclass: 0 subdevices_count: 1 subdevices_avail: 0 access: RW_INTERLEAVED format: DSD_U32_BE subformat: STD channels: 2 rate: 176400 (176400/1) period_size: 22050 buffer_size: 88200 card: 0 device: 0 subdevice: 0 stream: PLAYBACK id: USB Audio name: USB Audio subname: subdevice #0 class: 0 subclass: 0 subdevices_count: 1 subdevices_avail: 0 state: XRUN owner_pid : 1721 trigger_time: 1077.094251032 tstamp : 0.000000000 delay : 0 avail : 106956

avail_max : 106956

hw_ptr : 5314066 appl_ptr : 5295310 tstamp_mode: NONE period_step: 1 avail_min: 22050 start_threshold: 66150 stop_threshold: 88200 silence_threshold: 0 silence_size: 0 boundary: 1445068800`

Log root@vol:/mnt/USB/scr/linux-4.4.4# gdb /usr/local/bin/mpd GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-linux-gnueabihf". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/local/bin/mpd...done. (gdb) run --stdout --no-daemon --verbose Starting program: /usr/local/bin/mpd --stdout --no-daemon --verbose Dwarf Error: wrong version in compilation unit header (is 25282, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/1e/d0983c459b01a02ab776b49ece9e13ec9b9a8d.debug] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1". config_file: loading file /usr/local/etc/mpd.conf path: SetFSCharset: fs charset is: UTF-8 libsamplerate: libsamplerate converter 'Fastest Sinc Interpolator' vorbis: Xiph.Org libVorbis 1.3.5 opus: libopus 1.1.1 sndfile: libsndfile-1.0.25 wildmidi: configuration file does not exist: /etc/timidity/timidity.cfg adplug: adplug 2.2.1 db: reading DB curl: version 7.47.0 curl: with GnuTLS/3.4.9 [New Thread 0xb0d4f370 (LWP 1718)] avahi: Initializing interface avahi: Client changed to state 101 avahi: Client is CONNECTING [New Thread 0xb054f370 (LWP 1719)] state_file: Loading state file /var/lib/mpd/state [New Thread 0xafd4f370 (LWP 1720)] [New Thread 0xaf1f9370 (LWP 1721)] client: [0] opened from 127.0.0.1:38088 client: [0] process command "playlistinfo" client: [0] command returned 0 client: [1] opened from 127.0.0.1:38096 client: [0] process command "close" client: [0] command returned 3 client: [0] closed client: [1] process command "status" client: [1] command returned 0 client: [1] process command "playlistinfo 0" client: [1] command returned 0 client: [1] process command "close" client: [1] command returned 3 client: [1] closed client: [2] opened from 127.0.0.1:38108 client: [3] opened from 127.0.0.1:38114 client: [3] process command "playlistinfo" client: [3] command returned 0 client: [2] process command "status" client: [2] command returned 0 client: [3] process command "close" client: [3] command returned 3 client: [3] closed client: [2] process command "idle" client: [2] command returned 1 client: [4] opened from 127.0.0.1:38122 client: [4] closed client: [5] opened from 127.0.0.1:38130 client: [6] opened from 127.0.0.1:38142 client: [7] opened from 127.0.0.1:38144 client: [6] process command "lsinfo" client: [6] command returned 0 client: [7] closed client: [6] process command "close" client: [6] command returned 3 client: [6] closed client: [5] process command "status" client: [5] command returned 0 client: [5] process command "playlistinfo 0" client: [5] command returned 0 client: [5] process command "close" client: [5] command returned 3 client: [5] closed client: [8] opened from 127.0.0.1:38158 client: [8] process command "playlistinfo" client: [8] command returned 0 client: [9] opened from 127.0.0.1:38166 client: [8] process command "close" client: [8] command returned 3 client: [8] closed client: [9] process command "status" client: [9] command returned 0 client: [9] process command "idle" client: [9] command returned 1 client: [10] opened from 127.0.0.1:38176 client: [10] process command "play" playlist: play 0:"NAS/NAS/dsd/Roger Waters - Amused To Death_Stig_DSD/A1.The Ballad Of Bill Hubbard.dff" client: [10] command returned 0 client: [10] process command "close" client: [10] command returned 3 client: [10] closed playlist: queue song 1:"NAS/NAS/dsd/Roger Waters - Amused To Death_Stig_DSD/A2.What God Wants Part I.dff" decoder_thread: probing plugin dsdiff decoder: audio_format=705600:dsd:2, seekable=true alsa_output: opened hw:0,0 type=HW alsa_output: format=DSD_U32_BE (Direct Stream Digital, 4-byte (x32), big endian, oldest bits in MSB) alsa_output: buffer: size=46..131072 time=260..743039 alsa_output: period: size=23..65536 time=130..371520 alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000 alsa_output: buffer_size=88200 period_size=22050 output: opened plugin=alsa name="Output" audio_format=705600:dsd:2 client: [9] process command "status" client: [9] command returned 0 client: [2] process command "status" client: [2] command returned 0 client: [9] process command "playlistinfo 0" client: [9] command returned 0 client: [2] process command "playlistinfo 0" client: [2] command returned 0 client: [2] process command "close" client: [2] command returned 3 client: [2] closed client: [9] process command "close" client: [9] command returned 3 client: [9] closed client: [11] opened from 127.0.0.1:38184 client: [11] process command "status" client: [11] command returned 0 client: [11] process command "idle" client: [11] command returned 1 client: [12] opened from 127.0.0.1:38192 client: [12] closed client: [13] opened from 127.0.0.1:38200 client: [13] closed client: [14] opened from 127.0.0.1:38208 client: [14] closed client: [15] opened from 127.0.0.1:38216 client: [15] closed client: [16] opened from 127.0.0.1:38226 client: [16] closed client: [17] opened from 127.0.0.1:38234 client: [17] closed client: [18] opened from 127.0.0.1:38242 client: [18] closed client: [19] opened from 127.0.0.1:38250 client: [19] closed client: [20] opened from 127.0.0.1:38258 client: [20] closed client: [21] opened from 127.0.0.1:38266 client: [21] closed client: [22] opened from 127.0.0.1:38274 client: [22] closed client: [23] opened from 127.0.0.1:38282 client: [23] closed client: [24] opened from 127.0.0.1:38292 client: [24] process command "seek 0 230" playlist: queue song 1:"NAS/NAS/dsd/Roger Waters - Amused To Death_Stig_DSD/A2.What God Wants Part I.dff" client: [24] command returned 0 client: [24] process command "close" client: [24] command returned 3 client: [24] closed client: [11] process command "status" client: [11] command returned 0 client: [11] process command "playlistinfo 0" client: [11] command returned 0 client: [11] process command "close" client: [11] command returned 3 client: [11] closed client: [25] opened from 127.0.0.1:38300 client: [25] process command "status" client: [25] command returned 0 client: [25] process command "idle" client: [25] command returned 1 client: [26] opened from 127.0.0.1:38308 client: [26] closed client: [27] opened from 127.0.0.1:38316 client: [27] closed client: [28] opened from 127.0.0.1:38324 client: [28] closed client: [29] opened from 127.0.0.1:38332 client: [29] closed client: [30] opened from 127.0.0.1:38340 client: [30] closed client: [31] opened from 127.0.0.1:38348 client: [31] closed decoder_thread: probing plugin dsdiff decoder: audio_format=705600:dsd:2, seekable=true client: [32] opened from 127.0.0.1:38356 client: [32] closed client: [33] opened from 127.0.0.1:38364 client: [33] closed client: [34] opened from 127.0.0.1:38374 client: [34] process command "stop" playlist: stop It displays the rewinding to the end of the track (before we have bug) Directly error - does not display stop - do not help !

norrest commented 8 years ago

new 1.txt

norrest commented 8 years ago

https://dropmefiles.com/yoQDB test files!

lintweaker commented 8 years ago

This sounds like an old MPD bug where there is a little bit of data to play left at the end of a song. Making MPD hang. I had a workaround for it in MPD 0.18. It should be fixed in MPD 0.19 itself.

To verify, can you test with regular MPD 0.19 (mainline, non patched) while playing DoP output and DSD->PCM? If it hangs here as well -> regular MPD issue.

I'll test it myself as well.

norrest commented 8 years ago

Yesterday I tried to play it in the DoP mode - there were no problems. In DSD 128-> PCM mode, I do not have enough CPU-power to play, and the sound goes with jerks! But i try today to run it with PCM mode nevermind to jerks and look at the end of track!

lintweaker commented 8 years ago

Okay, so I probably have to re-add the workaround to my DSD native patch. When using DoP the sample size is changed preventing the bug to trigger.

I have updated my python DSD tools: https://github.com/lintweaker/python-dsd-tools

You can use dsdiff-info.py to check if a DSDIFF file could hang mpd: python dsdiff-info.py

It will print a warning

lintweaker commented 8 years ago

As a FYI, the bug is triggered by the amount of samples in de DSD file and is NOT related to it being DSD64, 128 , 256 etc.

norrest commented 8 years ago

./dsdiff-info.py A1.The_Ballad_Of_Bill_Hubbard.dff

Results for file : A1.The_Ballad_Of_Bill_Hubbard.dff

Found start chunk : 'FRM8' Total file size : 366938754

File pos now at : 16 Found chunk with id : 'FVER' Chunk size : 4 Found chunk with id : 'PROP' Chunk size : 74 Sample Rate Chunk Sample rate: 5644800 Hz Channels Chunk File has 2 channels Channel: SLFT Channel: SRGT Compression Type Chunk Compression type: 'DSD ' (Not compressed) Compression string length: 14

File pos now at : 118 Found chunk with id : 'DSD ' Chunk size : 366938486 DSD sample data starts at: 130

File pos now at : 366938616 Found chunk with id : 'COMT' Chunk size : 52

File pos now at : 366938680 Found chunk with id : 'DIIN' Chunk size : 74

Conclusion : This is a properly formatted DSDIFF file Warning : !!This file could hang MPD at the end of the song!!

lintweaker commented 8 years ago

I have updated the patch against MPD 0.19.13 with a workaround for the hang with certain DFF files.

norrest commented 8 years ago

Hi! Today i test it with Music Player Daemon 0.19.14-dsd and dsd crash again (