Commit Graph

161 Commits

Author SHA1 Message Date
Max Kellermann ce49d99c2f check.h: remove obsolete header
Since we switched from autotools to Meson in commit
94592c1406, 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-19 16:33:49 +01:00
Max Kellermann 9a813cd3b1 output/Thread: update comment 2018-11-12 12:09:02 +01:00
Max Kellermann 451b142e3a player/Thread: finish decoder startup before checking the buffer
This fixes a valgrind warning because `buffer_before_play`
initialization needs to know the audio format from the decoder.
2018-11-06 23:52:26 +01:00
Max Kellermann f5c9071494 *: copyright year 2018 2018-10-31 17:54:59 +01:00
Max Kellermann 9b6a2589e5 Merge branch 'v0.20.x' 2018-10-29 23:06:32 +01:00
Max Kellermann 7aa1dceef6 player/Control: move IDLE_PLAYER to Player::SeekDecoder()
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-10-29 12:01:48 +01:00
Max Kellermann 2ec94c0497 player/Control: start thread on demand
Keep MPD's footprint small until playback is requested.
2018-09-23 17:32:34 +02:00
Max Kellermann bf372e3e1f player/Control: move public methods up 2018-09-23 17:28:41 +02:00
Max Kellermann 0d971963fd player/Control: make several methods `private` 2018-09-23 17:27:42 +02:00
Max Kellermann 287cff40b9 player/Control: remove Lock(), Unlock() 2018-09-23 17:27:42 +02:00
Max Kellermann 0e0bc7976f player/Control: add LockGetSyncInfo() 2018-09-23 17:17:57 +02:00
Max Kellermann 8c638c50a3 player/Thread: remove obsolete `buffered_before_play` attribute 2018-09-23 16:50:04 +02:00
Max Kellermann 5b2374b949 player/Thread: calculate `buffered_before_play` based on a fixed duration
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-23 15:46:29 +02:00
Max Kellermann c1600bcf3d player/Thread: copy `buffered_before_play` 2018-09-23 15:46:27 +02:00
Max Kellermann 2f3845ef51 player/Thread: remove `buffered_before_play` from `decoder_wakeup_threshold` 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-23 15:00:47 +02:00
Max Kellermann 1191025bbf player/Thread: add attribute `decoder_wakeup_threshold`
Calculate the value only once.
2018-09-22 19:56:00 +02:00
Max Kellermann 84de88841b player/CrossFade: use AudioFormat::SizeToTime() instead of GetTimeToSize() 2018-09-22 19:37:45 +02:00
Max Kellermann 224400074c player/CrossFade: use std::chrono::duration 2018-09-22 19:37:02 +02:00
Max Kellermann 863722545f player/CrossFade, ...: use lround() 2018-09-22 19:08:03 +02:00
Max Kellermann d3d1d37782 AudioFormat: add TimeToSize(), SizeToTime() 2018-09-21 20:51:08 +02:00
Max Kellermann 1a2012a97e player/Control: convert `total_play_time` to `FloatDuration` 2018-09-21 20:50:15 +02:00
Max Kellermann 1d00d55d53 player/Thread: stop buffering if buffer is full
Shouldn't ever happen, but who knows...
2018-09-21 19:05:25 +02:00
Max Kellermann a190db0873 player/Thread: simplify loop condition 2018-09-21 18:58:38 +02:00
Max Kellermann e3142312bb player/Control: convert to class 2018-09-21 18:12:28 +02:00
Max Kellermann e5d1ac0bd0 player/Thread: move functions into PlayerControl 2018-09-21 18:09:14 +02:00
Max Kellermann 781e690012 player/Thread: catch and log initialization errors 2018-09-21 17:35:32 +02:00
Max Kellermann 9a2d71341e player/Control: apply CamelCase to struct player_status 2018-09-21 17:22:35 +02:00
Max Kellermann 6db6d3c50c player/Thread: move StartPlayerThread() into PlayerControl 2018-09-21 17:14:19 +02:00
Max Kellermann debdf9bb96 decoder/{Thread,Control,...}: rename source files, drop prefix 2018-09-21 17:01:24 +02:00
Max Kellermann 218d9383d7 decoder/Thread: move decoder_thread_start() into DecoderControl 2018-09-21 16:57:54 +02:00
Max Kellermann ec54754e22 Compiler.h: move to util/ 2018-08-20 16:19:17 +02:00
Max Kellermann 90201e9970 DetachedSong, db/LightSong, SongFilter: move to src/song/ 2018-08-02 13:51:18 +02:00
Max Kellermann efb8a9bd2c player, decoder, output: wrap MusicPipe in std::shared_ptr/std::unique_ptr 2018-06-23 18:45:57 +02:00
Max Kellermann 82954d1d6f player/Thread: eliminate ClearAndReplacePipe()
Since commit e81b089612, this is the
same code as in ReplacePipe().
2018-06-23 18:44:48 +02:00
Max Kellermann 2be905b2e2 MusicPipe: eliminate the unused MusicBuffer reference
This requires re-adding the reference to struct DecoderControl, which
was removed recently by commit
9f14e7a98d
2018-06-23 18:36:24 +02:00
Max Kellermann 54d295c247 MusicChunkPtr: managed MusicChunk pointer
Make all uses of MusicChunk safe.
2018-06-22 23:11:52 +02:00
Max Kellermann e81b089612 MusicPipe: automatically clear in destructor
We can implement this now that we have a MusicBuffer reference.
2018-06-22 23:09:13 +02:00
Max Kellermann 9f14e7a98d MusicPipe: add MusicBuffer reference
This tiny amount of overhead allows omitting the MusicBuffer in
Clear().
2018-06-22 22:59:44 +02:00
Max Kellermann 66a1e8b737 release v0.20.20
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlsD85IQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEm5xD/oCagsybi2L60r0trtjE7DJ+SnmgbjVmn3z
 aieaIA78KFK2QWUettevYkVwtwqEqyw5DwSDmxRRpm9sMKsdDBL+gLCf5hjIFNQY
 dZjyBIABgE+aAT+iYeXVmWgJI24s8znEGhZjUG5P/gf+CoLKvN5OQiZoBKOaurjX
 YwJUyLV1SXiMLV/4HtOFw4xORuRPflhZ5MnA+cO7BmpV0XQoq82XgBi3XqAB8dv4
 cIpDs0MU7DFHNUYHeHEWXVh1PgAcr2madWwQTiscuy8KRAR0GzkCsG5UrSyJs0xH
 c0yQ1vVt7X0nyxV35Yemmlfe4DwMwNK9avsTr3Mmr4tNDbxxhiddDYZzy6UJHKis
 vaVLhePLjXCOfPRivCY8zVZHwGTO5ArxQqftkGDnM1Gq8PwpTWLimZkvUW35d/xf
 SJ+ixpkA1O2DzmkyUam41phhXli+lt0hF1P/7dKsuV/fzmAkJlmRpgxJJhLH8mwq
 NNfHk8y8kdGoVy65e/u2asJe8PPB2y9NK2JmbBR9g6Dn+6puP4gkhok3a9cvUZ6q
 5GHJF9yRYswVkr/Y6q8UtESeEUczqrQTasVvq0fkxV0f17BKDbOxClb+ItrnPTWV
 WMfsyF3TYrHi4piB810q/nBY6pY7R2vQNCPMZwfjGlqn5amR2fm8QWecJVIPpkv3
 rEPv+4r8nQ==
 =DEYg
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.20'

release v0.20.20
2018-05-22 12:47:11 +02:00
Max Kellermann c76f4ac89b player/Thread: pause all outputs in single mode
This mostly affects the Pulse output plugin which needs to "cork" the
stream (closes #278).
2018-05-12 14:44:07 +02:00
Max Kellermann 43a43c1e2b release v0.20.19
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlriEvAQHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEnEpD/4+yH4ydc9l1/j5AD08jFyUUe6YSnC8gLsG
 DRrSOU1BQltYAPhlRGxA/HlKxboaT7v5qcXBdIV+HwKs6149j8qxip8g8PYoUBmB
 mn6YckjEPCLpLe4WSvfGdm5a1aI7nMC76wHBvTPCAMTZk9FAmUED4DqgNYmWycOd
 MpXZbzZdvb2Ti4dQARrK8AbMjTD44LXDOhBgWYnZLpo1ovYhnGvTPAElCQN23tbT
 VMcJPYe86lzgs1vWwgURzkn7Y3CaSMF3G+aKw/oLEK3giZmE0y7Kov9Ycy4IC6+3
 aXuEP9drMIltAyZ2hmeH6JFigbgQbDhwuAu1biYLLukwa0oEOEFTP1+yxAVbi/vx
 58rD6uWJeFbqPna6146TAYVi8QeymJWfhFWxkcol2u7etrIxXpX//qo8Mv+AiLor
 wOrTerKgRFYmtSH14wIoSfKsn2wmsXOhDE38h621PAzqvQXDzrBLMo4HMJ4y+G+q
 Y6LZWatweL6I2qMsOKWvECOJNxQJrkDFOLq8Mj+O4v6iiLQWhiul1hi2g8EOcRMI
 SkdWTakla3LbmuUN1dKQJwoojNevnP5yPXI15rM6JMZkXJcWxi4mvnzoAFnBTmov
 57GxpShueo2yy9yrFgS7hBuRsBXzYxze/xY0LSYSO4SjCjNCnWXse6O9pI7JqFbI
 m5JJW96Nqg==
 =1wwq
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.19'

release v0.20.19
2018-04-26 20:06:41 +02:00
Max Kellermann 44b200240f player/Thread: never reuse decoder when switching radio streams
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-04-25 21:19:26 +02:00
Patryk Hachuła 1628d801f9 playlist/Queue: add one-shot to single mode 2018-02-25 09:50:03 +01:00
Max Kellermann 73ddbcc876 player/Thread: wake up the main thread after failed seek
Fixes deadlock bug.  Closes #210
2018-02-03 19:28:39 +01:00
Max Kellermann db379c6172 player/Thread: remove bogus "noexcept" from play_chunk()
Closes #203
2018-01-24 11:21:28 +01:00
Max Kellermann efb528f979 player/Thread: wake up the decoder when the pipe has run empty
This is another instance of the kludge we already have a few lines
above that.  It works around a deadlock/race condition revealed by
commit 98a7c62d7a
2018-01-12 14:33:22 +01:00
Max Kellermann 8649ea3d6f thread/Thread: use BoundMethod 2018-01-07 17:20:26 +01:00
Max Kellermann 98a7c62d7a player/Thread: don't send silence if decoder is slow
The output plugin shall decide whether to insert silence or do nothing
at all.  The ALSA output plugin has already implemented this.
Inserting silence is not necessary or helpful for some plugins, and
may even hurt them (e.g. "recorder").
2018-01-03 17:36:41 +01:00
Max Kellermann 859e59262e player/Thread: remove unnecessary "continue" keywords 2018-01-03 17:17:22 +01:00
Max Kellermann ec113420f1 player/Thread: hold mutex while calling SongBorder()
Eliminates unnecessary mutex locks.
2018-01-03 17:12:21 +01:00