DecoderControl: convert mutex and client_cond to a reference
Share the Mutex between the DecoderThread and the PlayerThread. This simplifies synchronization between the two threads and fixes a freeze problem: while the PlayerThread waits for the DeocderThread, it cannot answer requests from the main thread, and the main thread will block until the DecoderThread finishes.
This commit is contained in:
@@ -26,8 +26,9 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
DecoderControl::DecoderControl()
|
||||
:state(DecoderState::STOP),
|
||||
DecoderControl::DecoderControl(Mutex &_mutex, Cond &_client_cond)
|
||||
:mutex(_mutex), client_cond(_client_cond),
|
||||
state(DecoderState::STOP),
|
||||
command(DecoderCommand::NONE),
|
||||
song(nullptr),
|
||||
replay_gain_db(0), replay_gain_prev_db(0) {}
|
||||
|
||||
Reference in New Issue
Block a user