Commit Graph

117 Commits

Author SHA1 Message Date
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
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
Max Kellermann
1194998ce9 CrossFade: use sizeof(MusicChunk::data) instead of CHUNK_SIZE 2017-12-30 17:43:56 +01:00
Max Kellermann
7171e23700 player/Thread: make seeking into a new song non-blocking 2017-12-30 11:31:26 +01:00
Max Kellermann
dee378b775 player/Thread: make SEEK (partially) non-blocking
When the decoder is still starting up while we handle a SEEK, finish
the "player SEEK" immediately and re-enter the player loop, being able
to handle commands (and even cancel the pending seek).

This is the first part in a series of patches to solve the "blocking
input blocks decoder, blocks player, blocks the main thread" problem.
There are many other blocking code locations left, and the main thread
isn't non-blocking either because it waits for "seeking" to become
false.
2017-12-29 17:32:12 +01:00
Max Kellermann
c40354bbcb player/Outputs: abstract interface wrapping class MultipleOutputs 2017-12-29 16:39:05 +01:00
Max Kellermann
e31abe6d6b player/Thread: remove redundant outputs.Cancel() call
The STOP, EXIT and CLOSE_AUDIO commands are not finished here; they
are propagated to PlayerControl::RunThread() where the
outputs.Cancel() call will be done again.
2017-12-28 08:39:48 +01:00
Max Kellermann
e1349ccadc player/Thread: ProcessCommand() returns bool
Allows signalling a failed seek, and replaces several redundant
command checks after the ProcessCommand() call.
2017-12-28 08:30:01 +01:00
Max Kellermann
8838bdc1e3 player/Thread: move CommandFinished() call out of SeekDecoder(SongTime)
Decouple this function from player command execution.
2017-12-27 14:28:56 +01:00
Max Kellermann
d6386bc80f player/Thread: update code comment 2017-12-27 14:26:14 +01:00
Max Kellermann
6439727afc player/Thread: use std::lock_guard in RunThread() 2017-12-22 09:35:31 +01:00
Max Kellermann
27b0a581a6 player/Thread: even more fine-grained unlocking
Use one single std::lock_guard in Run(), and replace the manual
Lock()/Unlock() calls.
2017-12-22 08:09:16 +01:00
Max Kellermann
15a54230f1 player/Thread: move unlock call down
Eliminate more unlock/lock transitions, making the code more robust.
2017-12-22 01:14:51 +01:00
Max Kellermann
f0d184884a player/Thread: remove obsolete commented code 2017-12-22 01:14:39 +01:00
Max Kellermann
8fca04f140 player/Thread: add missing lock for StartDecoder()
Regression from commit 0772e571b7
2017-12-22 01:12:15 +01:00
Max Kellermann
3b2b5edd26 player/Thread: move mutex lock out of SeekDecoder() 2017-12-22 01:07:13 +01:00
Max Kellermann
5bd1fbb0d6 player/Thread: merge four mutex locks in SeekDecoder() 2017-12-22 01:04:44 +01:00
Max Kellermann
0772e571b7 player/Thread: move mutex lock out of StartDecoder() 2017-12-22 01:03:12 +01:00
Max Kellermann
910496cea9 decoder/Control: caller must lock mutex for Start() 2017-12-22 01:03:01 +01:00
Max Kellermann
739e1da279 player/Thread: move mutex lock out of ActivateDecoder() 2017-12-22 00:58:57 +01:00
Max Kellermann
08b4a7aaf2 player/Thread: eliminate LockWaitDecoderStartup() 2017-12-22 00:58:42 +01:00
Max Kellermann
1f0770ca55 player/Thread: move code to SeekDecoder(SongTime) 2017-12-22 00:49:21 +01:00
Max Kellermann
505d0bfa51 player/Thread: move mutex lock out of StopDecoder() 2017-12-22 00:48:19 +01:00
Max Kellermann
860d13c7d8 decoder/Control: caller must lock mutex for Stop() 2017-12-22 00:48:12 +01:00
Max Kellermann
76d77af0f0 player/Thread: use std::lock_guard once more 2017-12-22 00:47:36 +01:00
Max Kellermann
ea8ab4ddf2 player/Thread: merge two mutex locks 2017-12-22 00:42:10 +01:00
Max Kellermann
4bcc38c749 player/Thread: move mutex lock out of WaitDecoderStartup() 2017-12-22 00:41:05 +01:00
Max Kellermann
5becffbba5 player/Thread: merge two mutex locks 2017-12-22 00:39:54 +01:00
Max Kellermann
d0194a6fb3 decoder/Control: caller must lock mutex for Seek() 2017-12-22 00:37:25 +01:00
Max Kellermann
e45d13d469 player/Thread: add missing mutex lock around PlayerControl::SetError() 2017-12-22 00:35:18 +01:00
Max Kellermann
a431274b32 player/Control: add "occupied" flag to skip REFRESH
Reduces main thread contention.  Avoids blocking the main thread in
"status" commands.
2017-12-21 10:25:40 +01:00
Max Kellermann
994c9a01e3 player/Control: reorder attributes to reduce padding 2017-12-21 10:25:38 +01:00
Max Kellermann
b2670eaba5 player/Thread: move start_time variable into the scope 2017-12-20 19:15:28 +01:00
Max Kellermann
54aff33118 player/Thread: reorder attributes to reduce padding 2017-12-20 18:43:56 +01:00
Max Kellermann
25fa3ccade MusicChunk, player/Thread: use std::unique_ptr<Tag> 2017-12-20 15:02:14 +01:00
Max Kellermann
4286f55c52 player/Thread: use C++11 initializers 2017-12-20 13:35:07 +01:00
Max Kellermann
0a7cad9074 player/Thread: add "noexcept" 2017-12-20 13:32:38 +01:00
Max Kellermann
069a7fe71e player/Thread: more API documentation 2017-12-20 13:27:13 +01:00
Max Kellermann
9c8a45854a player/Control: add SEEK documentation 2017-12-20 12:20:11 +01:00
Max Kellermann
7d035edf9d player/Control, ...: remove API documentation references to the obsolete Error class 2017-12-20 12:20:09 +01:00
Max Kellermann
914df18bf9 Main, ...: catch any exception, not just std::runtime_error 2017-12-19 10:56:23 +01:00
Max Kellermann
fbc4bb29dc Merge branch 'v0.20.x' 2017-12-03 16:22:08 +01:00
Max Kellermann
de90d401d2 MusicChunk: add magic value IGNORE_REPLAY_GAIN
This fixes spurious replay gain logs when the player inserts silence
chunks, because those silence chunks had no replay gain attached,
resetting the ReplayGainFilter state, flipping it forth and back.
2017-12-03 11:39:12 +01:00
Max Kellermann
396defaea9 MusicChunk: initialize replay_gain_serial on demand 2017-12-03 11:39:07 +01:00
Max Kellermann
18f350cd04 player/Thread: initialize MusicChunk::bit_rate in SendSilence()
This attribute is not particularly important, but it was
uninitialized.
2017-12-03 10:54:14 +01:00
Max Kellermann
520c520512 player/Listener: add "noexcept" 2017-11-26 12:39:09 +01:00