Commit Graph

1056 Commits

Author SHA1 Message Date
Max Kellermann
a9f2d25957 output/Thread: unify exception handling 2016-12-29 14:10:37 +01:00
Max Kellermann
4011899846 system/PeriodClock: use std::chrono::steady_clock 2016-12-28 22:23:45 +01:00
Max Kellermann
28e743ba70 output/Timer: include cleanup 2016-12-28 22:23:45 +01:00
Max Kellermann
71e7d32b08 output/Timer: use std::chrono 2016-12-28 22:00:33 +01:00
Max Kellermann
d5e422970c output/Plugin: delay() returns std::chrono::steady_clock::duration 2016-12-28 22:00:29 +01:00
Max Kellermann
a3ca9963a5 output/Timer: pass size_t to Add() 2016-12-28 10:17:29 +01:00
Max Kellermann
2d3c23876c output/Timer: use C++11 initializers 2016-12-28 10:16:41 +01:00
Max Kellermann
bd8d8eef3e output/Timer: no "time" initialization if !started 2016-12-28 10:16:11 +01:00
Max Kellermann
9e33074735 output/Thread: move software_mixer_set_filter() call to Open()
.. and remove the obsolete method OpenFilter().
2016-12-27 14:44:39 +01:00
Max Kellermann
d6d465cdf4 output/Thread: fix assertion failure in CLOSE handler
Convert assertion to runtime check; this assertion could fail when the
output was closed due to an error before CLOSE arrived.
2016-12-27 07:57:22 +01:00
Max Kellermann
e76573cc1a output/Thread: use "true" instead of "1" 2016-12-27 07:53:02 +01:00
Max Kellermann
3fa6dc71e2 output/Source: add assertion 2016-12-26 20:10:00 +01:00
Max Kellermann
6fec269844 output/SharedPipeConsumer: add thread-safety documentation 2016-12-26 20:09:10 +01:00
Max Kellermann
b6004b6837 output/Source: release the mutex while the filter runs
The filter can take some time to finish, even more so on a weak
machine with a saturated CPU.  By not holding the mutex during that
time, we can reduce PlayerThread latency a lot, because that thread
needs to synchronize a lot with all outputs.
2016-12-26 20:02:15 +01:00
Max Kellermann
86d3b25aec output/Source: add Fill(), ReadTag(), PeekData(), ConsumeData()
Don't expose MusicChunk instances, provide higher-level access to
chunk contents.
2016-12-26 13:53:22 +01:00
Max Kellermann
8a407bfbb0 output/Thread: move code to new class AudioOutputSource 2016-12-26 13:35:19 +01:00
Max Kellermann
d30a590d9e configure.ac: use MPD_AUTO for libsndio and Haiku 2016-12-26 13:35:19 +01:00
Max Kellermann
f95e404be1 outputThread: optimize Command::OPEN
Try harder to skip steps (reopen filter, reopen output) if the
AudioOutput is already open.
2016-12-24 14:05:11 +01:00
Max Kellermann
ffb8b4fc68 output/Internal: add method ClearTailChunk() 2016-12-22 14:46:59 +01:00
Max Kellermann
f86d6b0162 output/Control: move pipe initialization to the OutputThread
Un-protect the SharedPipeConsumer instance, and make it available in
the OutputThread only.  This gives more well-defined mutex protection.
2016-12-22 14:04:38 +01:00
Max Kellermann
71c72ed072 output/Control: use Command::OPEN to unpause, remove special case 2016-12-22 14:04:38 +01:00
Max Kellermann
a8d343e07b output/Thread: update in_audio_format before ReopenFilter() 2016-12-22 14:04:34 +01:00
Max Kellermann
d020172181 output/Thread: keep the device open if the audio format hasn't changed
Add another condition to Reopen() which allows keeping it open.
2016-12-21 17:45:01 +01:00
Max Kellermann
e5c9f6c1fe output/Internal: add attribute request.audio_format
Make in_audio_format accessible only from within the OutputThread, and
add a new one for inter-thread communication.
2016-12-21 17:00:29 +01:00
Max Kellermann
176dc11748 output/Thread: ao_filter_chunk() throws exception on error
Move the error logging to AudioOutput::PlayChunk().
2016-12-20 17:40:11 +01:00
Max Kellermann
c2abd02b9b output/Thread: use ConstBuffer::skip_front() 2016-12-20 17:38:08 +01:00
Max Kellermann
12ecfdd423 output/Thread: convert pointer to reference 2016-12-20 17:35:38 +01:00
Max Kellermann
67cfbfc2f3 output/SharedPipeConsumer: update API documentation 2016-12-20 16:35:14 +01:00
Max Kellermann
ccb45b6f6e output/Client: new interface to replace direct access to class PlayerControl 2016-12-14 20:29:15 +01:00
Max Kellermann
ece5971027 output/Multiple: move Wait() to struct PlayerControl
Eliminate a dependency from MultipleOutputs on PlayerControl.
2016-12-14 19:37:01 +01:00
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