When starting MPD with state state: play and time: xxxx.xx when the current track is a stream without a duration (av_stream.duration = 0x8000000000000000 (AV_NOPTS_VALUE)), the call to av_seek_frame in FfmpegDecode never returns or fails (depending on the value of time: xxxx.xx).
It looks like the bug is in ffmpeg, but may be MPD can work around it somehow, perhaps not try to seek if the stream has no duration?
Expected Behavior
MPD start playing the stream either where is left off or restart it if seeking failed.
Actual Behavior
MPD is not responsive as ffmpeg keeps seeking the stream for unknown time (waited minutes).
It seem that small values of time (time: < 5) result in decoder error, but larger vaues e.g. 60 keep seeking for a long time.
It is reproducible with this state file (this state file was result of playing the stream then pausing and terminating MPD after it wrote the state file):
The second stream is working (change current to 1) but it takes different code path and it has a duration while the first does not have a duration.
Version
Music Player Daemon 0.22~git (v0.21.24-1007-gc6a7f6dab)
Copyright 2003-2007 Warren Dukes
Copyright 2008-2018 Max Kellermann
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 upnp
Storage plugins:
local smbclient udisks nfs curl
Neighbor plugins:
smbclient upnp udisks
Decoders plugins:
[mad] mp3 mp2
[mpg123] mp3
[vorbis] ogg oga
[oggflac] ogg oga
[flac] flac
[opus] opus ogg oga
[sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
[audiofile] wav au aiff aif
[dsdiff] dff
[dsf] dsf
[hybrid_dsd] m4a
[faad] aac
[mpcdec] mpc
[wavpack] wv
[modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm
[mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm
[sidplay] sid mus str prg P00
[wildmidi] mid
[fluidsynth] mid
[adplug] amd d00 hsc laa rad raw sa2
[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
[gme] ay gbs gym hes kss nsf nsfe sap spc vgm vgz
[pcm]
Filters:
libsamplerate soxr
Tag plugins:
id3tag
Output plugins:
shout null fifo sndio pipe alsa ao openal pulse jack httpd recorder
Encoder plugins:
null vorbis opus lame twolame wave flac shine
Archive plugins:
[bz2] bz2
[zzip] zip
[iso] iso
Input plugins:
file archive alsa tidal qobuz curl ffmpeg smbclient nfs mms cdio_paranoia
Playlist plugins:
extm3u m3u pls xspf asx rss soundcloud flac cue embcue
Protocols:
file:// alsa:// cdda:// ftp:// ftps:// gopher:// http:// https:// mms:// mmsh:// mmst:// mmsu:// nfs:// qobuz:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// scp:// sftp:// smb:// srtp:// tidal://
Other features:
avahi dbus udisks epoll icu inotify ipv6 systemd tcp un
Stack trace
Thread #5 not returning from av_seek_frame even after a long time.
Attaching to program: /home/devel/mpd.master/bin/mpd, process 14476
[New LWP 14484]
[New LWP 14485]
[New LWP 14486]
[New LWP 14487]
[New LWP 14489]
Traceback (most recent call last):
File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28-gdb.py", line 60, in
from libstdcxx.v6 import register_libstdcxx_printers
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f3b5857c65e in epoll_wait (epfd=4, events=0x7ffd657e5c80, maxevents=16, timeout=-1)
at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
30 ../sysdeps/unix/sysv/linux/epoll_wait.c: No such file or directory.
Thread 6 (Thread 0x7f3b4a1d4700 (LWP 14489)):
#0 0x00007f3b5865b2c6 in futex_wait_cancelable (private=, expected=0, futex_word=0x55f75b600814) at ../sysdeps/unix/sysv/linux/futex-internal.h:80
#1 0x00007f3b5865b2c6 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x55f75b600868, cond=0x55f75b6007e8) at pthread_cond_wait.c:508
#2 0x00007f3b5865b2c6 in __pthread_cond_wait (cond=0x55f75b6007e8, mutex=0x55f75b600868) at pthread_cond_wait.c:638
#3 0x00007f3b588a82f0 in std::condition_variable::wait(std::unique_lock&) () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x000055f757db6edf in AudioOutputControl::Task() (this=0x55f75b600700) at ../src/output/Thread.cxx:520
#5 0x000055f757db1d87 in BindMethodDetail::BindMethodWrapperGenerator2::Invoke(void*) (_instance=0x55f75b600700) at ../src/util/BindMethod.hxx:189
#6 0x000055f757d356b0 in BoundMethod::operator()() const (this=0x55f75b6007c8) at ../src/util/BindMethod.hxx:91
#7 0x000055f757d39bfe in Thread::Run() (this=0x55f75b6007c8) at ../src/thread/Thread.cxx:63
#8 0x000055f757d39bdb in Thread::ThreadProc(void*) (ctx=0x55f75b6007c8) at ../src/thread/Thread.cxx:92
#9 0x00007f3b58654669 in start_thread (arg=) at pthread_create.c:479
#10 0x00007f3b5857c323 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 5 (Thread 0x7f3b4b656700 (LWP 14487)):
#0 0x00007f3b5856fc2f in __GI___poll (fds=0x7f3b4b64e0f0, nfds=1, timeout=100) at ../sysdeps/unix/sysv/linux/poll.c:29
#1 0x00007f3b5e417580 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#2 0x00007f3b5e417602 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#3 0x00007f3b5e479712 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#4 0x00007f3b5e342e3c in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#5 0x00007f3b5e393ca4 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#6 0x00007f3b5e394bf5 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#7 0x00007f3b5e395c53 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#8 0x00007f3b5e39692f in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#9 0x00007f3b5e341ea5 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#10 0x00007f3b5e342376 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#11 0x00007f3b5e346e3c in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#12 0x00007f3b5e346eb2 in avio_open2 () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#13 0x00007f3b5e356249 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#14 0x00007f3b5e359ab3 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#15 0x00007f3b5e3464a5 in avio_read () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#16 0x00007f3b5e374b35 in av_probe_input_buffer2 () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#17 0x00007f3b5e374cad in av_probe_input_buffer () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#18 0x00007f3b5e354de1 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#19 0x00007f3b5e3567a4 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#20 0x00007f3b5e48a492 in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#21 0x00007f3b5e48ad4b in () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#22 0x00007f3b5e48bbc8 in av_read_frame () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#23 0x00007f3b5e48be3b in av_seek_frame () at /usr/lib/x86_64-linux-gnu/libavformat.so.58
#24 0x000055f757de76d4 in FfmpegDecode(DecoderClient&, InputStream&, AVFormatContext&) (client=..., input=..., format_context=...) at ../src/decoder/plugins/FfmpegDecoderPlugin.cxx:539
#25 0x000055f757de7a36 in ffmpeg_decode(DecoderClient&, InputStream&) (client=..., input=...) at ../src/decoder/plugins/FfmpegDecoderPlugin.cxx:590
#26 0x000055f757cc8da6 in DecoderPlugin::StreamDecode(DecoderClient&, InputStream&) const (this=0x55f757f94880 , client=..., is=...) at ../src/decoder/DecoderPlugin.hxx:179
#27 0x000055f757cc6e2e in decoder_stream_decode(DecoderPlugin const&, DecoderBridge&, InputStream&, std::unique_lock&) (plugin=..., bridge=..., input_stream=..., lock=...) at ../src/decoder/Thread.cxx:82
#28 0x000055f757cc7491 in decoder_run_stream_fallback(DecoderBridge&, InputStream&, std::unique_lock&) (bridge=..., is=..., lock=...) at ../src/decoder/Thread.cxx:207
#29 0x000055f757cc76c5 in decoder_run_stream(DecoderBridge&, char const*) (bridge=..., uri=0x7f3b44000e80 "http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/dash/nonuk/dash_low/llnw/bbc_radio_fourfm.mpd") at ../src/decoder/Thread.cxx:263
#30 0x000055f757cc7d03 in DecoderUnlockedRunUri(DecoderBridge&, char const*, Path) (bridge=..., real_uri=0x7f3b44000e80 "http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/dash/nonuk/dash_low/llnw/bbc_radio_fourfm.mpd", path_fs=...) at ../src/decoder/Thread.cxx:384
#31 0x000055f757cc7fe5 in decoder_run_song(DecoderControl&, DetachedSong const&, char const*, Path) (dc=..., song=..., uri=0x7f3b44000e80 "http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/dash/nonuk/dash_low/llnw/bbc_radio_fourfm.mpd", path_fs=...) at ../src/decoder/Thread.cxx:445
#32 0x000055f757cc82ae in decoder_run(DecoderControl&) (dc=...) at ../src/decoder/Thread.cxx:486
#33 0x000055f757cc844c in DecoderControl::RunThread() (this=0x7f3b4be562d0) at ../src/decoder/Thread.cxx:511
#34 0x000055f757ccb1ae in BindMethodDetail::BindMethodWrapperGenerator2::Invoke(void*) (_instance=0x7f3b4be562d0) at ../src/util/BindMethod.hxx:189
#35 0x000055f757d356b0 in BoundMethod::operator()() const (this=0x7f3b4be562d8) at ../src/util/BindMethod.hxx:91
#36 0x000055f757d39bfe in Thread::Run() (this=0x7f3b4be562d8) at ../src/thread/Thread.cxx:63
#37 0x000055f757d39bdb in Thread::ThreadProc(void*) (ctx=0x7f3b4be562d8) at ../src/thread/Thread.cxx:92
#38 0x00007f3b58654669 in start_thread (arg=) at pthread_create.c:479
#39 0x00007f3b5857c323 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 4 (Thread 0x7f3b4be57700 (LWP 14486)):
#0 0x00007f3b5865b2c6 in futex_wait_cancelable (private=, expected=0, futex_word=0x55f7598f08dc) at ../sysdeps/unix/sysv/linux/futex-internal.h:80
#1 0x00007f3b5865b2c6 in __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x55f7598f0888, cond=0x55f7598f08b0) at pthread_cond_wait.c:508
#2 0x00007f3b5865b2c6 in __pthread_cond_wait (cond=0x55f7598f08b0, mutex=0x55f7598f0888) at pthread_cond_wait.c:638
#3 0x00007f3b588a82f0 in std::condition_variable::wait(std::unique_lock&) () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x000055f757cca71b in DecoderControl::WaitForDecoder(std::unique_lock&) (this=0x7f3b4be562d0, lock=...) at ../src/decoder/Control.hxx:224
#5 0x000055f757ce36f6 in Player::Run() (this=0x7f3b4be561d0) at ../src/player/Thread.cxx:1018
#6 0x000055f757ce0b32 in do_play(PlayerControl&, DecoderControl&, MusicBuffer&) (pc=..., dc=..., buffer=...) at ../src/player/Thread.cxx:1151
#7 0x000055f757ce0cd4 in PlayerControl::RunThread() (this=0x55f7598f0838) at ../src/player/Thread.cxx:1177
#8 0x000055f757ce6a8d in BindMethodDetail::BindMethodWrapperGenerator2::Invoke(void*) (_instance=0x55f7598f0838) at ../src/util/BindMethod.hxx:189
#9 0x000055f757d356b0 in BoundMethod::operator()() const (this=0x55f7598f0868) at ../src/util/BindMethod.hxx:91
#10 0x000055f757d39bfe in Thread::Run() (this=0x55f7598f0868) at ../src/thread/Thread.cxx:63
#11 0x000055f757d39bdb in Thread::ThreadProc(void*) (ctx=0x55f7598f0868) at ../src/thread/Thread.cxx:92
#12 0x00007f3b58654669 in start_thread (arg=) at pthread_create.c:479
#13 0x00007f3b5857c323 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 3 (Thread 0x7f3b4c658700 (LWP 14485)):
#0 0x00007f3b5857c65e in epoll_wait (epfd=8, events=0x7ffd657e5f88, maxevents=16, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1 0x000055f757d34eaa in EpollFD::Wait(epoll_event*, int, int) (this=0x7ffd657e5f84, events=0x7ffd657e5f88, maxevents=16, timeout=-1) at ../src/system/EpollFD.hxx:55
#2 0x000055f757d35079 in PollGroupEpoll::ReadEvents(PollResultEpoll&, int) (this=0x7ffd657e5f84, result=..., timeout_ms=-1) at ../src/event/PollGroupEpoll.hxx:75
#3 0x000055f757d348e3 in EventLoop::Run() (this=0x7ffd657e5ef0) at ../src/event/Loop.cxx:232
#4 0x000055f757d33dba in EventThread::Run() (this=0x7ffd657e5ef0) at ../src/event/Thread.cxx:65
#5 0x000055f757cda5cf in BindMethodDetail::BindMethodWrapperGenerator2::Invoke(void*) (_instance=0x7ffd657e5ef0) at ../src/util/BindMethod.hxx:189
#6 0x000055f757d356b0 in BoundMethod::operator()() const (this=0x7ffd657e6058) at ../src/util/BindMethod.hxx:91
#7 0x000055f757d39bfe in Thread::Run() (this=0x7ffd657e6058) at ../src/thread/Thread.cxx:63
#8 0x000055f757d39bdb in Thread::ThreadProc(void*) (ctx=0x7ffd657e6058) at ../src/thread/Thread.cxx:92
#9 0x00007f3b58654669 in start_thread (arg=) at pthread_create.c:479
#10 0x00007f3b5857c323 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 2 (Thread 0x7f3b4ce59700 (LWP 14484)):
#0 0x00007f3b5857c65e in epoll_wait (epfd=6, events=0x7ffd657e5df8, maxevents=16, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1 0x000055f757d34eaa in EpollFD::Wait(epoll_event*, int, int) (this=0x7ffd657e5df4, events=0x7ffd657e5df8, maxevents=16, timeout=-1) at ../src/system/EpollFD.hxx:55
#2 0x000055f757d35079 in PollGroupEpoll::ReadEvents(PollResultEpoll&, int) (this=0x7ffd657e5df4, result=..., timeout_ms=-1) at ../src/event/PollGroupEpoll.hxx:75
#3 0x000055f757d348e3 in EventLoop::Run() (this=0x7ffd657e5d60) at ../src/event/Loop.cxx:232
#4 0x000055f757d33dba in EventThread::Run() (this=0x7ffd657e5d60) at ../src/event/Thread.cxx:65
#5 0x000055f757cda5cf in BindMethodDetail::BindMethodWrapperGenerator2::Invoke(void*) (_instance=0x7ffd657e5d60) at ../src/util/BindMethod.hxx:189
#6 0x000055f757d356b0 in BoundMethod::operator()() const (this=0x7ffd657e5ec8) at ../src/util/BindMethod.hxx:91
#7 0x000055f757d39bfe in Thread::Run() (this=0x7ffd657e5ec8) at ../src/thread/Thread.cxx:63
#8 0x000055f757d39bdb in Thread::ThreadProc(void*) (ctx=0x7ffd657e5ec8) at ../src/thread/Thread.cxx:92
#9 0x00007f3b58654669 in start_thread (arg=) at pthread_create.c:479
#10 0x00007f3b5857c323 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 1 (Thread 0x7f3b4db05140 (LWP 14476)):
#0 0x00007f3b5857c65e in epoll_wait (epfd=4, events=0x7ffd657e5c80, maxevents=16, timeout=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1 0x000055f757d34eaa in EpollFD::Wait(epoll_event*, int, int) (this=0x7ffd657e5c7c, events=0x7ffd657e5c80, maxevents=16, timeout=-1) at ../src/system/EpollFD.hxx:55
#2 0x000055f757d35079 in PollGroupEpoll::ReadEvents(PollResultEpoll&, int) (this=0x7ffd657e5c7c, result=..., timeout_ms=-1) at ../src/event/PollGroupEpoll.hxx:75
#3 0x000055f757d348e3 in EventLoop::Run() (this=0x7ffd657e5be8) at ../src/event/Loop.cxx:232
#4 0x000055f757cb2921 in MainConfigured(options const&, ConfigData const&) (options=..., raw_config=...) at ../src/Main.cxx:530
#5 0x000055f757cb2ba7 in MainOrThrow(int, char**) (argc=5, argv=0x7ffd657e64f8) at ../src/Main.cxx:606
#6 0x000055f757cb2c57 in mpd_main(int, char**) (argc=5, argv=0x7ffd657e64f8) at ../src/Main.cxx:614
#7 0x000055f757cb2ce7 in main(int, char**) (argc=5, argv=0x7ffd657e64f8) at ../src/Main.cxx:628
I can reproduce this problem, but unfortunately there is nothing I can do. This is completely running inside FFmpeg, and FFmpeg provides no way for the calling application to cancel it. Sorry.
Bug report
Describe the bug
When starting MPD with state
state: play
andtime: xxxx.xx
when the current track is a stream without a duration (av_stream.duration = 0x8000000000000000 (AV_NOPTS_VALUE)
), the call toav_seek_frame
inFfmpegDecode
never returns or fails (depending on the value oftime: xxxx.xx
).It looks like the bug is in ffmpeg, but may be MPD can work around it somehow, perhaps not try to seek if the stream has no duration?
Expected Behavior
MPD start playing the stream either where is left off or restart it if seeking failed.
Actual Behavior
MPD is not responsive as ffmpeg keeps seeking the stream for unknown time (waited minutes). It seem that small values of time (
time: < 5
) result in decoder error, but larger vaues e.g. 60 keep seeking for a long time.It is reproducible with this state file (this state file was result of playing the stream then pausing and terminating MPD after it wrote the state file):
The second stream is working (change current to 1) but it takes different code path and it has a duration while the first does not have a duration.
Version
Stack trace
Thread
#5
not returning fromav_seek_frame
even after a long time.Log
After this it keeps trying to get files with incremented time but they are all 404.