summaryrefslogtreecommitdiff
path: root/src/player
AgeCommit message (Collapse)Author
2019-12-23util/Compiler.h: add gcc_fallthroughMax Kellermann
Works around build failures with ccache which may feed processed code to GCC, which doesn't have the "fall through" code comments.
2019-08-03player/Thread: don't restart unseekable song after failed seek attemptMax Kellermann
The check IsSeekableCurrentSong() was added by commit 44b200240f1f4b8394dd2e58fec72da3d3ec448f in version 0.20.19, but it caused a regression: by doing the branch only if the current song is seekable, the player would restart the current song if it was not seekable, and later the initial seek would fail; but we already know it's not seekable, and so we should fail early.
2019-05-31Revert "player/Thread: remove unnecessary "pipe" check"Max Kellermann
This reverts commit ff3e2c05142c94efadee00812ec348c15f1be1ba. The check was necessary, after all, because this is what checked whether the decoder had finished the current or the next song. > The "queued" flag can only possibly be set if the decoder is still > decoding the current song or if the decoder is stopped. That was wrong because ProcessCommand() sets `queued=true` and also starts the decoder (if it was idle). > This is also what the following assert() checks. That was also wrong, because the assert() has two conditions. Closes https://github.com/MusicPlayerDaemon/MPD/issues/566
2019-05-20player/Thread: fix "single" mode race conditionMax Kellermann
If the decoder finishes decoding the current song between the two IsIdle() checks, MPD stops playback instead of starting the decoder for the next song. This is usually not visible problem, because the main thread restarts it via playlist::ResumePlayback(), but that way it, ignores "single" mode. As a workaround, this commit adds another "queued" check which re-enters the player loop and checks again whether to start the decoder. Closes https://github.com/MusicPlayerDaemon/MPD/issues/556
2019-05-20player/Thread: remove unnecessary "pipe" checkMax Kellermann
The "queued" flag can only possibly be set if the decoder is still decoding the current song or if the decoder is stopped. This is also what the following assert() checks. This check was not necessary.
2018-11-19check.h: remove obsolete headerMax Kellermann
Since we switched from autotools to Meson in commit 94592c14062d5afc9482d11baa401648082022c0, we don't need to include `config.h` early to properly enable large file support. Meson passes the required macros on the compiler command line instead of defining them in `config.h`. This means we can include `config.h` at any time, whenever we want to check its macros, and there are no ordering constraints.
2018-11-12output/Thread: update commentMax Kellermann
2018-11-06player/Thread: finish decoder startup before checking the bufferMax Kellermann
This fixes a valgrind warning because `buffer_before_play` initialization needs to know the audio format from the decoder.
2018-10-31*: copyright year 2018Max Kellermann
2018-10-29Merge branch 'v0.20.x'Max Kellermann
2018-10-29player/Control: move IDLE_PLAYER to Player::SeekDecoder()Max Kellermann
This emits the event even if PlayerControl::Play() is used to replay the current song, which emits the missing "player" idle event. Closes #381
2018-09-23player/Control: start thread on demandMax Kellermann
Keep MPD's footprint small until playback is requested.
2018-09-23player/Control: move public methods upMax Kellermann
2018-09-23player/Control: make several methods `private`Max Kellermann
2018-09-23player/Control: remove Lock(), Unlock()Max Kellermann
2018-09-23player/Control: add LockGetSyncInfo()Max Kellermann
2018-09-23player/Thread: remove obsolete `buffered_before_play` attributeMax Kellermann
2018-09-23player/Thread: calculate `buffered_before_play` based on a fixed durationMax Kellermann
Previously, there was the setting `buffered_before_play` which specified a percentage of the audio buffer, defaulting to `10%`. That was working well enough for quite some time, until high-quality audio formats became common. At 44.1 kHz, 16 bit stereo, MPD collected 2.3 seconds worth of data in the buffer before starting playback. With the same default settings and 192 kHz, 24 bit stereo, that was only 0.27 seconds. Making this depend on the byte size only leads to high latency at low quality, and too little data at high quality. The natural choice would be to use a duration instead of a byte size, which should give the same good experience with all audio formats. Since the `buffered_before_play` configuration setting was not understood well by users and caused more harm than good, this commit deprecates it. It has now no effect.
2018-09-23player/Thread: copy `buffered_before_play`Max Kellermann
2018-09-23player/Thread: remove `buffered_before_play` from `decoder_wakeup_threshold` ↵Max Kellermann
formula Simplify the formula, and I guess this makes the formula more reliable. Imagine somebody configured `buffered_before_play` larger than 25%; then the decoder would be woken up all the time. This doesn't seem logical. On the other hand, it's easy to understand that the decoder should be woken up below 75% buffer fill.
2018-09-22player/Thread: add attribute `decoder_wakeup_threshold`Max Kellermann
Calculate the value only once.
2018-09-22player/CrossFade: use AudioFormat::SizeToTime() instead of GetTimeToSize()Max Kellermann
2018-09-22player/CrossFade: use std::chrono::durationMax Kellermann
2018-09-22player/CrossFade, ...: use lround()Max Kellermann
2018-09-21AudioFormat: add TimeToSize(), SizeToTime()Max Kellermann
2018-09-21player/Control: convert `total_play_time` to `FloatDuration`Max Kellermann
2018-09-21player/Thread: stop buffering if buffer is fullMax Kellermann
Shouldn't ever happen, but who knows...
2018-09-21player/Thread: simplify loop conditionMax Kellermann
2018-09-21player/Control: convert to classMax Kellermann
2018-09-21player/Thread: move functions into PlayerControlMax Kellermann
2018-09-21player/Thread: catch and log initialization errorsMax Kellermann
2018-09-21player/Control: apply CamelCase to struct player_statusMax Kellermann
2018-09-21player/Thread: move StartPlayerThread() into PlayerControlMax Kellermann
2018-09-21decoder/{Thread,Control,...}: rename source files, drop prefixMax Kellermann
2018-09-21decoder/Thread: move decoder_thread_start() into DecoderControlMax Kellermann
2018-08-20Compiler.h: move to util/Max Kellermann
2018-08-02DetachedSong, db/LightSong, SongFilter: move to src/song/Max Kellermann
2018-06-23player, decoder, output: wrap MusicPipe in std::shared_ptr/std::unique_ptrMax Kellermann
2018-06-23player/Thread: eliminate ClearAndReplacePipe()Max Kellermann
Since commit e81b089612833b61c566b482640615e182949ac6, this is the same code as in ReplacePipe().
2018-06-23MusicPipe: eliminate the unused MusicBuffer referenceMax Kellermann
This requires re-adding the reference to struct DecoderControl, which was removed recently by commit 9f14e7a98d8be5cc4b916456df0124b65ece8ae4
2018-06-22MusicChunkPtr: managed MusicChunk pointerMax Kellermann
Make all uses of MusicChunk safe.
2018-06-22MusicPipe: automatically clear in destructorMax Kellermann
We can implement this now that we have a MusicBuffer reference.
2018-06-22MusicPipe: add MusicBuffer referenceMax Kellermann
This tiny amount of overhead allows omitting the MusicBuffer in Clear().
2018-05-22Merge tag 'v0.20.20'Max Kellermann
release v0.20.20
2018-05-12player/Thread: pause all outputs in single modeMax Kellermann
This mostly affects the Pulse output plugin which needs to "cork" the stream (closes #278).
2018-04-26Merge tag 'v0.20.19'Max Kellermann
release v0.20.19
2018-04-25player/Thread: never reuse decoder when switching radio streamsMax Kellermann
When switching to another song manually, the player checks if the decoder is already decoding that song; if so, it will attempt to reuse it by seeking it to the new position. That however fails if the decoder is not seekable (e.g. a radio stream) which leaves the user unable to switch to that song with the bogus error message "Not seekable".
2018-02-25playlist/Queue: add one-shot to single modePatryk Hachuła
2018-02-03player/Thread: wake up the main thread after failed seekMax Kellermann
Fixes deadlock bug. Closes #210
2018-01-24player/Thread: remove bogus "noexcept" from play_chunk()Max Kellermann
Closes #203