Commit Graph

1076 Commits

Author SHA1 Message Date
Max Kellermann
7e1b53480e output/MultipleOutputs: parallelize EnableDisable() 2016-12-14 08:41:42 +01:00
Max Kellermann
6425b4f9f5 output/MultipleOutputs: parallelize AudioOutput destruction
Reduce latency by stopping all AudioOutputs asynchronously.
2016-12-14 08:35:07 +01:00
Max Kellermann
fb907f5f76 output/Thread: KILL implicitly closes and disables the AudioOutput
Reduce shutdown latency by two commands per output.
2016-12-14 08:29:09 +01:00
Max Kellermann
b107a1583f output/MultipleOutputs: move code to AudioOutput::EnableDisableWait() 2016-12-14 08:00:43 +01:00
Max Kellermann
ced3f320eb output/MultipleOutputs: reduce lock/unlock calls in EnableDisable()
Use ScopeLock to manage the lock; don't unlock after obtaining the
"really_enabled" flag; keep the same lock during EnableWait() /
DisableWait().
2016-12-14 07:54:05 +01:00
Max Kellermann
a9d7293818 output/Thread: wake up the player thread periodically while playing
Without this, the pipe would run empty very often, which may result in
an xrun if the roundtrip to the PlayerThread and back takes too long.
By waking up the PlayerThread before the pipe runs empty, we make MPD
much more latency tolerant, which is a major optimization.
2016-12-13 22:39:49 +01:00
Max Kellermann
265ad4b96a output/Thread: eliminate redundant nullptr check 2016-12-13 22:20:41 +01:00
Max Kellermann
92eeb4969f output/Thread: don't wake up the player after receiving command in Play()
If we have a pending command, then the player thread is already awake.
Even if not, we'll wake it up as soon as we have finished the command.
2016-12-13 22:17:06 +01:00
Max Kellermann
6fcddaf8fa output/Thread: use AtScopeExit() to revert the in_playback_loop flag 2016-12-13 22:15:52 +01:00
Max Kellermann
41fd583fbc output/Thread: eliminate one ScopeLock 2016-12-13 21:57:03 +01:00
Max Kellermann
ceba6816de output/Thread: split Open()
Simplify the code, eliminate duplicate rollback code and eliminate the
"goto" kludge.
2016-12-13 21:46:27 +01:00
Max Kellermann
093cb475bb output/Thread: simplify the retry_audio_format declaration 2016-12-13 21:34:43 +01:00
Max Kellermann
d44790b35f output/Thread: reduce locking further in Open() 2016-12-13 21:26:28 +01:00
Max Kellermann
f8164a3dd1 output/Thread: unlock mutex during OpenFilter() 2016-12-13 21:24:14 +01:00
Max Kellermann
c20126598f output/Thread: remove unused variable 2016-12-13 21:24:05 +01:00
Max Kellermann
6c818bb37a AudioFormat: add method WithMask(), shortcut for ApplyMask() 2016-12-13 20:57:46 +01:00
Max Kellermann
df91f3738a output/Thread: remove a useless out_audio_format setting
Now that I can see the Reopen() method clearly, it is obvious that the
out_audio_format setting will get overwritten by the following Open()
call.
2016-12-13 20:43:29 +01:00
Max Kellermann
b5b268f606 output/Thread: remove another redundant "open" check 2016-12-13 20:41:54 +01:00
Max Kellermann
ce6b8c94a2 output/Thread: convert redundant runtime check to assertion 2016-12-13 20:29:16 +01:00
Max Kellermann
6e643fe58b output/Thread: don't deinitialize the pipe in Close() 2016-12-13 20:28:19 +01:00
Max Kellermann
2bf91a0487 output/Internal: merge REOPEN and OPEN 2016-12-13 20:07:00 +01:00
Max Kellermann
2775d747ac output/Thread: move MusicPipe code to class SharedPipeConsumer 2016-12-13 16:33:23 +01:00
Max Kellermann
dc05dd7ca1 output/Multiple: make chunk_is_consumed_in() an AudioOutput method 2016-12-11 21:59:28 +01:00
Max Kellermann
3000b9dcde filter/ReplayGain: add ReplayGainConfig copy
Remove dependency on ReplayGain global variables.
2016-12-03 12:51:02 +01:00
Max Kellermann
3b867462a3 filter/ReplayGain: remove FilterPlugin instance, add explicit constructor 2016-12-03 12:34:23 +01:00
Max Kellermann
bfb0897b54 filter/ReplayGain: convert pointers to references 2016-12-03 12:13:45 +01:00
Max Kellermann
5f396e824f ReplayGainMode: convert to strictly-typed enum 2016-11-24 17:34:57 +01:00
Max Kellermann
4f229c254c ReplayGainInfo: move enum ReplayGainMode to separate header 2016-11-24 17:34:57 +01:00
Max Kellermann
509f62f68d output/MultipleOutputs: throw exception instead of calling FatalError() 2016-11-24 14:04:40 +01:00
Max Kellermann
35a2a48c47 Merge branch 'v0.19.x' 2016-11-17 22:20:24 +01:00
Max Kellermann
5c3e55b5b1 {input,output}/alsa: fix gcc 7.0 -Wimplicit-fallthrough 2016-11-16 19:50:38 +01:00
Dave Hocker
f6a85f0b0b output/osx: fix build failure 2016-11-10 12:55:08 +01:00
Max Kellermann
d9cb85df83 output/Plugin: remove 'Error&' parameters, use C++ exceptions only 2016-11-09 12:36:21 +01:00
Max Kellermann
445e82be75 output/Multiple: migrate from class Error to C++ exceptions 2016-11-09 12:31:23 +01:00
Max Kellermann
b78cc7e48a output/Thread: remove obsolete pcm_domain check, this is defunct 2016-11-09 12:15:35 +01:00
Max Kellermann
ac9ce0b3ad output/Init: migrate _setup() from class Error to C++ exceptions 2016-11-09 12:09:00 +01:00
Max Kellermann
cf2b814629 output/Init: migrate Configure() from class Error to C++ exceptions 2016-11-09 12:06:54 +01:00
Max Kellermann
bbe7a37359 output/Internal: hide Configure() and remove the non-configuring constructor 2016-11-09 12:06:06 +01:00
Max Kellermann
d0aa154ea6 output/null: migrate from class Error to C++ exceptions 2016-11-09 12:03:20 +01:00
Max Kellermann
df4616ae4a output/osx: migrate from class Error to C++ exceptions
Beware, this commit was not tested.  I don't have OS X, but I want to
prepare an API change.
2016-11-09 11:51:28 +01:00
Max Kellermann
10f62db9fd output/osx: use std::unique_ptr
Eliminate all those "goto"s and make the function exception-safe.
2016-11-09 11:50:14 +01:00
Max Kellermann
5c075210d6 output/osx: use AtScopeExit() to call CFRelease() 2016-11-09 11:49:21 +01:00
Max Kellermann
0cf85b0771 output/haiku: eliminate DoClose() 2016-11-09 11:42:00 +01:00
Max Kellermann
fa90047e52 output/haiku: migrate from class Error to C++ exceptions
Beware, this commit was not tested.  I don't have Haiku, but I want to
prepare an API change.
2016-11-09 11:39:11 +01:00
Max Kellermann
b9f64fe19b output/haiku: embed "format" into the HaikuOutput class
Avoid one level of dynamic allocation.
2016-11-09 11:36:38 +01:00
Max Kellermann
dd072912e8 output/solaris: migrate from class Error to C++ exceptions 2016-11-09 11:18:19 +01:00
Max Kellermann
9dbdc75689 output/httpd: migrate from class Error to C++ exceptions 2016-11-09 08:40:10 +01:00
Max Kellermann
dce211dbba output/sles: migrate from class Error to C++ exceptions 2016-11-09 08:35:35 +01:00
Max Kellermann
b4e5fa5c1b output/roar: migrate from class Error to C++ exceptions 2016-11-09 08:29:44 +01:00
Max Kellermann
f12fa7e20a output/shout: migrate from class Error to C++ exceptions 2016-11-08 15:40:19 +01:00
Max Kellermann
96f8f1da0c output/OpenAL: migrate from class Error to C++ exceptions 2016-11-08 15:19:30 +01:00
Max Kellermann
db7eec042e output/sndio: migrate from class Error to C++ exceptions 2016-11-08 15:15:16 +01:00
Max Kellermann
52aed3f8a1 output/jack: migrate from class Error to C++ exceptions 2016-11-08 15:11:21 +01:00
Max Kellermann
cadd186f1b output/jack: use AtScopeExit() 2016-11-08 15:10:38 +01:00
Max Kellermann
dd9ab16d67 output/recorder: migrate from class Error to C++ exceptions 2016-11-07 09:48:10 +01:00
Max Kellermann
d8b6aff23a encoder: migrate from class Error to C++ exceptions 2016-11-07 09:25:51 +01:00
Max Kellermann
b8aac3f8fc output/Thread: catch and log send_tag() exceptions 2016-11-07 09:25:47 +01:00
Max Kellermann
4aab97ccb1 config/Path: throw std::runtime_error on error 2016-11-07 09:07:50 +01:00
Max Kellermann
1859ba5ec8 output/winmm: 8 bit playback is not supported
Everything must be S16.
2016-11-07 08:53:57 +01:00
Max Kellermann
54d5184255 output/winmm: use std::array 2016-11-07 08:50:58 +01:00
Max Kellermann
0c5b986fc4 output/winmm: use range-based "for" 2016-11-07 08:28:41 +01:00
Max Kellermann
7b2cdd618e output/winmm: use AudioOutputWrapper 2016-11-07 08:08:42 +01:00
Max Kellermann
30bb3f1fcb output/winmm: migrate from class Error to C++ exceptions 2016-11-07 07:42:18 +01:00
Max Kellermann
b45ea66175 output/pipe: migrate from class Error to C++ exceptions 2016-11-05 15:24:10 +01:00
Max Kellermann
543c5034af output/fifo: migrate from class Error to C++ exceptions 2016-11-05 15:13:14 +01:00
Max Kellermann
c8aa7afdc6 output/oss: migrate from class Error to C++ exceptions 2016-11-05 13:18:45 +01:00
Max Kellermann
b35bb1b50c output/alsa: use C++ initializers 2016-11-04 11:31:23 +01:00
Max Kellermann
6341be9cdf output/alsa: migrate from class Error to C++ exceptions 2016-11-04 11:31:23 +01:00
Max Kellermann
93a14a93f9 output/alsa: use Error::FormatPrefix() 2016-11-04 11:31:23 +01:00
Max Kellermann
d6559e2ac9 output/Thread: fix wrong error reference in catch clause 2016-11-04 11:31:23 +01:00
Max Kellermann
65e6755b8b output/ao: migrate from class Error to C++ exceptions 2016-11-02 12:36:13 +01:00
Max Kellermann
6ead9750f4 output/pulse: migrate from class Error to C++ exceptions 2016-11-02 11:01:22 +01:00
Max Kellermann
6532c7e089 output/pulse: use C++11 initializers 2016-11-02 11:01:07 +01:00
Max Kellermann
8b3d934230 output/Thread: catch Pause() exceptions 2016-11-02 10:53:43 +01:00
Max Kellermann
e2b7c30811 event/BufferedSocket: pass std::exception_ptr to OnSocketError() 2016-11-02 10:38:05 +01:00
Max Kellermann
e17805f208 config/Block: GetPath() throws exception on error 2016-10-28 23:08:42 +02:00
Max Kellermann
d8bcdca55a config/Block: rename GetBlockPath() to GetPath() 2016-10-28 23:07:26 +02:00
Max Kellermann
f6f2a3b366 output/alsa: throw C++ exception on init error 2016-10-28 22:56:27 +02:00
Max Kellermann
d52c7e7a1b output/httpd: throw C++ exception on init error 2016-10-28 22:42:10 +02:00
Max Kellermann
c4acccac14 output/Init: add constructor overload which calls Configure() 2016-10-28 22:41:07 +02:00
Max Kellermann
13001c018c AudioParser: throw exception on error 2016-10-28 22:36:04 +02:00
Max Kellermann
0c343cb1c3 encoder/Plugin: migrate from class Error to C++ exceptions 2016-10-28 21:29:01 +02:00
Max Kellermann
aead221184 event/ServerSocket: migrate from class Error to C++ exceptions 2016-10-28 21:22:25 +02:00
Max Kellermann
0c464b24ad OutputInit: allow "init" to throw exception 2016-10-28 21:11:52 +02:00
Max Kellermann
a249a630c0 OutputThread: support plugins throwing exceptions 2016-10-28 21:10:18 +02:00
Max Kellermann
f39823eac0 OutputThread: use class ScopeUnlock for exception-safety 2016-10-28 21:10:18 +02:00
Max Kellermann
69de99636f OutputPlugin: update API documentation 2016-10-28 21:10:18 +02:00
Max Kellermann
5b2b4bf13c config/Param: use CamelCase 2016-10-28 11:38:37 +02:00
Yue Wang
d0302d1bbe _delay in output plugin will now ask the thread to repeatedly wait until it returns 0.
change the _delay API doc so that it matches its implementation behavior.
2016-09-19 10:24:56 -07:00
Yue Wang
d73267df5e use osx_output_delay to wait until ring buffer is able to write
This further optimize the performance. 

This is now working properly with a conditional variable bug being fixed (8bbfb5cda1).
2016-09-19 08:51:03 -07:00
Yue Wang
f881917d2f Fix a bug that buffer_frame_size is not properly initialized 2016-09-18 21:09:57 -07:00
Yue Wang
99244f51b0 Remove unused imports 2016-09-18 19:40:55 -07:00
Yue Wang
606d029ed9 Kill mutex and locks in osx_render. Improve performance. Also fix an initialization problem 2016-09-18 19:40:04 -07:00
Yue Wang
e4b9d679fb options for sample rate syncing and device hogging 2016-09-18 19:12:45 -07:00
Yue Wang
4a8a33ea85 Hogging is for user selected device only.
do not hog system device.
2016-09-18 13:15:46 -07:00
Yue Wang
ac4b83046a Add sample rate synchronization and device hogging to core audio plugin
which ensures mpd do bit perfect playback on OS X
2016-09-18 12:52:08 -07:00
Max Kellermann
e7d327226a mixer: migrate to C++ exceptions 2016-09-09 14:44:15 +02:00
Max Kellermann
860064c812 output/pulse: use a RTTI lock guard
Make all the locks exception-safe.
2016-09-09 14:36:24 +02:00
Max Kellermann
1c07f197de Filter/Plugin: migrate from class Error to C++ exceptions 2016-09-04 20:07:05 +02:00
Max Kellermann
13c32111a0 Filter/Internal: migrate from class Error to C++ exceptions 2016-09-04 19:38:41 +02:00
Max Kellermann
12091fcfb1 thread/Util: throw exception on error 2016-09-04 15:15:11 +02:00
Max Kellermann
3fea624cca output/Thread: use Close() after error in ReopenFilter()
Now that CloseFilter() may be called again, we can reduce code
duplication.
2016-09-04 15:09:51 +02:00
Max Kellermann
9007dd9ab7 output/Thread: clear Filter pointers in CloseFilter()
This allows calling CloseFilter() multiple times.
2016-09-04 15:09:05 +02:00
Max Kellermann
08166cf330 output/Internal: initialize the Filter pointers
With the configuration "replay_gain_handler none", the Filter pointers
are never initialized, which can crash MPD.

 https://bugs.musicpd.org/view.php?id=4571
2016-09-04 15:05:42 +02:00
Earnestly
e2f6cc9c9f Don't overwrite ss.format
Currently the switch statement is invalidated by ss.format being overwritten
with the default value of PA_SIMPLE_S16NE which results in white noise during
playback as my server is expected S16LE (S16NE).

Signed-off-by: Earnestly <zibeon@gmail.com>
2016-08-23 10:01:56 +02:00
Max Kellermann
ba69ade024 Compiler.h: add macro CLANG_OR_GCC_VERSION() 2016-08-23 09:48:58 +02:00
Max Kellermann
ea0e6d9824 fs/FileSystem: RemoveFile() throws exception on error 2016-08-15 22:25:15 +02:00
Max Kellermann
743fa73a01 Merge branch 'v0.19.x' 2016-08-15 12:33:07 +02:00
Nils Schneider
62000670e3 Support S24_P32/S32/FLOAT sample formats on Pulse
This is based on a patch from Ian Scott in 2014. It was never committed,
so I figured I'd fix the outstanding issue and resubmit it.

https://www.mail-archive.com/mpd-devel%40musicpd.org/msg00139.html
2016-08-15 10:02:29 +02:00
Max Kellermann
ac49043fbb output/pulse: move variable declaration down 2016-08-15 10:02:22 +02:00
Jacob Vosmaer
4d6192adcd Use a ScopeLock around condition.wait() 2016-08-07 15:47:21 +02:00
Jacob Vosmaer
9f1ada898e Improve readability of frame completion loop 2016-08-07 14:15:55 +02:00
Jacob Vosmaer
5617521380 Must lock/unlock around wait 2016-08-06 15:25:58 +02:00
Jacob Vosmaer
9835a2545d Do not assume two pops are enough 2016-08-06 15:19:10 +02:00
Jacob Vosmaer
c28cefeeb0 output/osx: wait-free render callback
Closes https://bugs.musicpd.org/view.php?id=4537 .

Removed the 'cancel' function because it violates 'single producer,
single consumer'.
2016-08-06 00:08:10 +02:00
Max Kellermann
2777a23672 Merge branch 'v0.19.x' 2016-07-29 20:25:59 +02:00
Max Kellermann
83aed7051c output/shout: rename "encoding" to "encoder"
The user manual specifies "encoder", which is consistent with other
output plugins.  "encoding" should be deprecated.
2016-07-29 10:52:03 +02:00
Jacob Vosmaer
ad80acb22a output/osx: remove incorrect memset behavior
In e068d62 I added code that zeros the remainder of the output buffer
if there are not enough input frames available. I have now learned
that we can signal to the caller of the render callback how much data
is in the output buffers. In practice, the input buffer is so large
that it does not matter so much how we handle input buffer underruns,
but I suppose that saying 'there is no data' is better than 'here is
some silence for you'.
2016-07-22 20:58:37 +02:00
Jacob Vosmaer
4cd9abe632 output/osx channel_map feature 2016-07-09 18:29:35 +02:00
Max Kellermann
b67e7df38e release v0.19.17
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXgCv6AAoJECNuiljG20USR3cP/RALB4qlhecMo6H8VwZvfjiA
 FHfhBKfdpHM3U3EEIZc1zxwHIdWk1yELtmx298vmJbWUifpYAYarXF5497tZf2XE
 AVfhTltEJEd7xB5ZULnEScM1aHzMZm5HRcHwM1UqNCsXP7PT8fmpk7gw19pKOChT
 h8V3+tpC403lCIcHcJGlkuzgZvKIZDs73g7a0+4GxD9XRAPwnMYRl3Cfd8QjKT/U
 r67AcOwQlS6hWJFs0K1JjOQwfwbRq2YmuOmFJua6n8O6CI/7t4h3faSQ0V/5qjFd
 k/pAMRtX6mz3mjVhZv4cuMy+QILWlxUNwLBIwtxSfbwcFKrN0vtIRG8O9622hTs2
 +mvYiVboWABk6hnukiDAfki96jWYHlsCJR5oIK9DZ4nBe5RVp0r9Nq/ook2AW2it
 6VgYIDBI5zS/blyJzXtzDVWEtSmLFxm21JSl+jHfWDtL6/rQGimdVOFkRw40oCBz
 seYb5kIbilrg6xq1KiBMT+EWmXMf+q+3YWQsu01blXGYGPhpUqhIr0h/qUfWAqMs
 fwIsoxsTrkQQjEWb6YWupPrdOLZ+kTAyaK+7v8B8JmzS/H3SohusMPUZKsQXl82s
 5LJVLtVxB9WRRmpfSoYqfk7CkTHOktCzVmiHb/FYUYElS9VKmJYYU8XQ25snCoZ6
 bYtERsH28q8rrpkWWEXP
 =IXD5
 -----END PGP SIGNATURE-----

Merge tag 'v0.19.17'

release v0.19.17
2016-07-09 00:46:09 +02:00
Jacob Vosmaer
e068d62ac6 output/osx rewrite render callback 2016-07-08 15:36:42 +02:00
Max Kellermann
1c7de0b4ac output/shout: remove pointless memset() call 2016-07-05 18:02:35 +02:00
Jacob Vosmaer
2fdbae3e1f Remove braces 2016-07-03 16:45:23 +02:00
Jacob Vosmaer
87e06793c2 Get rid of GetMacOSStatusCommentString 2016-07-03 14:06:53 +02:00
Jacob Vosmaer
8cc451a2e2 Use error.Set instead of error.Format 2016-07-03 13:36:35 +02:00
Jacob Vosmaer
723c2c7fa9 Remove some debugging code 2016-07-03 13:18:44 +02:00
Jacob Vosmaer
4dd2c5cdd5 Convert device name from CFStringRef to char* 2016-07-03 12:59:19 +02:00
Jacob Vosmaer
bdc257b40e Add debug statements 2016-07-02 23:44:21 +02:00
Jacob Vosmaer
4728f7c697 Use AudioComponent instead of Carbon Component 2016-07-02 23:35:44 +02:00
Max Kellermann
3a21241248 filter/FilterInternal: split class Filter, add class PreparedFilter
For easier state management inside filter plugins.
2016-07-01 21:04:24 +02:00
Max Kellermann
a43b0f5253 mixer/software: move Filter management to the AudioOutput 2016-07-01 18:23:53 +02:00
Dimitris Papastamos
4a6df9f961 output/sndio: Remove unused attribute
The variable is actually used in this function.
2016-06-24 09:11:36 +02:00
Dimitris Papastamos
a43ae2369b output/sndio: Add 24-bit 4-byte packed audio format support 2016-06-24 09:11:30 +02:00
Dimitris Papastamos
9a049de859 output/sndio: No need to use a loop in Play()
This is a left-over from the previous version of the code
that was retrying on EINTR.
2016-06-24 09:10:57 +02:00
Dimitris Papastamos
58b8398aa0 output/sndio: Use size_t instead of ssize_t
Some minor style fixes as well.
2016-06-23 11:11:42 +02:00
Max Kellermann
645751f680 output/Init: use C++11 initializers 2016-06-22 18:44:00 +02:00
Dimitris Papastamos
26c0924461 sndio: Eliminate remaining goto usage to conform to MPD style 2016-06-22 16:10:46 +02:00
Dimitris Papastamos
d4f801a8e9 sndio: Fix segmentation fault when audio card is removed
This can happen if you remove an external audio card or if you stop
sndiod(8) while playing a song.

sio_write() will retry internally if it fails with errno == EINTR
so no need to handle that.
2016-06-22 16:10:38 +02:00
Dimitris Papastamos
8406864963 sndio: Allow tweaking application buffer size
It defaults to 250 ms.
2016-06-22 16:09:57 +02:00
Dimitris Papastamos
d68cadba7b sndio: No need to use a timer so get rid of it 2016-06-22 11:28:58 +02:00
Max Kellermann
1207fd1f16 output/sndio: remove unnecessary initialization 2016-06-22 11:01:37 +02:00
Dimitris Papastamos
8aa61e230c sndio: Add option to select output device 2016-06-22 11:00:06 +02:00
Max Kellermann
2c7bda8a3b output/sndio: define SIO_DEVANY if it is undefined
Fixes build failure on Debian Wheezy.
2016-06-22 10:58:44 +02:00
Dimitris Papastamos
d58c5dd398 sndio: Implement sndio_test_default_device() 2016-06-22 10:54:59 +02:00
Dimitris Papastamos
171da7a347 Add sndio output plugin 2016-06-22 08:44:47 +02:00
Max Kellermann
d3c7fac606 thread/Thread: throw std::system_error on error 2016-06-17 19:11:20 +02:00
Max Kellermann
b376536a3b encoder/Interface: convert PreparedEncoder to abstract class 2016-05-04 18:32:52 +02:00
Max Kellermann
e7edc02647 encoder/Interface: move instance methods to abstract class
Rename struct Encoder to PreparedEncoder, and add a new (abstract)
class Encoder which represents one encoder instance.
2016-05-04 16:32:31 +02:00
Max Kellermann
6407b7c591 output/recorder: use C++11 initializers 2016-05-04 15:18:57 +02:00
Max Kellermann
e14cd92d59 output/shout: use AudioOutputWrapper 2016-05-04 15:06:29 +02:00