diff options
author | Max Kellermann <max@musicpd.org> | 2016-11-18 08:36:06 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-11-18 09:01:32 +0100 |
commit | 595d1942cb795adcc0c037389aeb8238c788a3c0 (patch) | |
tree | ffc136e2523bb914d85daabec01238d99d358991 /src | |
parent | b90593399954643f36e32767dedf6d5184d12736 (diff) |
decoder/Internal: rename "chunk" to "current_chunk"
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/DecoderAPI.cxx | 14 | ||||
-rw-r--r-- | src/decoder/DecoderInternal.cxx | 21 | ||||
-rw-r--r-- | src/decoder/DecoderInternal.hxx | 2 | ||||
-rw-r--r-- | src/decoder/DecoderThread.cxx | 2 |
4 files changed, 19 insertions, 20 deletions
diff --git a/src/decoder/DecoderAPI.cxx b/src/decoder/DecoderAPI.cxx index f49c4c8a5..a80ac85be 100644 --- a/src/decoder/DecoderAPI.cxx +++ b/src/decoder/DecoderAPI.cxx @@ -183,7 +183,7 @@ decoder_command_finished(Decoder &decoder) if (decoder.initial_seek_running) { assert(!decoder.seeking); - assert(decoder.chunk == nullptr); + assert(decoder.current_chunk == nullptr); assert(dc.pipe->IsEmpty()); decoder.initial_seek_running = false; @@ -196,9 +196,9 @@ decoder_command_finished(Decoder &decoder) /* delete frames from the old song position */ - if (decoder.chunk != nullptr) { - dc.buffer->Return(decoder.chunk); - decoder.chunk = nullptr; + if (decoder.current_chunk != nullptr) { + dc.buffer->Return(decoder.current_chunk); + decoder.current_chunk = nullptr; } dc.pipe->Clear(*dc.buffer); @@ -400,13 +400,13 @@ do_send_tag(Decoder &decoder, const Tag &tag) { MusicChunk *chunk; - if (decoder.chunk != nullptr) { + if (decoder.current_chunk != nullptr) { /* there is a partial chunk - flush it, we want the tag in a new chunk */ decoder.FlushChunk(); } - assert(decoder.chunk == nullptr); + assert(decoder.current_chunk == nullptr); chunk = decoder.GetChunk(); if (chunk == nullptr) { @@ -620,7 +620,7 @@ decoder_replay_gain(Decoder &decoder, decoder.replay_gain_info = *replay_gain_info; decoder.replay_gain_serial = serial; - if (decoder.chunk != nullptr) { + if (decoder.current_chunk != nullptr) { /* flush the current chunk because the new replay gain values affect the following samples */ diff --git a/src/decoder/DecoderInternal.cxx b/src/decoder/DecoderInternal.cxx index 22b9a43bf..be9540b96 100644 --- a/src/decoder/DecoderInternal.cxx +++ b/src/decoder/DecoderInternal.cxx @@ -31,7 +31,7 @@ Decoder::~Decoder() { /* caller must flush the chunk */ - assert(chunk == nullptr); + assert(current_chunk == nullptr); if (convert != nullptr) { convert->Close(); @@ -68,17 +68,17 @@ Decoder::GetChunk() { DecoderCommand cmd; - if (chunk != nullptr) - return chunk; + if (current_chunk != nullptr) + return current_chunk; do { - chunk = dc.buffer->Allocate(); - if (chunk != nullptr) { - chunk->replay_gain_serial = replay_gain_serial; + current_chunk = dc.buffer->Allocate(); + if (current_chunk != nullptr) { + current_chunk->replay_gain_serial = replay_gain_serial; if (replay_gain_serial != 0) - chunk->replay_gain_info = replay_gain_info; + current_chunk->replay_gain_info = replay_gain_info; - return chunk; + return current_chunk; } cmd = LockNeedChunks(dc); @@ -93,15 +93,14 @@ Decoder::FlushChunk() assert(!seeking); assert(!initial_seek_running); assert(!initial_seek_pending); - assert(chunk != nullptr); + assert(current_chunk != nullptr); + auto *chunk = std::exchange(current_chunk, nullptr); if (chunk->IsEmpty()) dc.buffer->Return(chunk); else dc.pipe->Push(chunk); - chunk = nullptr; - const ScopeLock protect(dc.mutex); if (dc.client_is_waiting) dc.client_cond.signal(); diff --git a/src/decoder/DecoderInternal.hxx b/src/decoder/DecoderInternal.hxx index b7df55bf1..ccf9885f4 100644 --- a/src/decoder/DecoderInternal.hxx +++ b/src/decoder/DecoderInternal.hxx @@ -78,7 +78,7 @@ struct Decoder { Tag *decoder_tag = nullptr; /** the chunk currently being written to */ - MusicChunk *chunk = nullptr; + MusicChunk *current_chunk = nullptr; ReplayGainInfo replay_gain_info; diff --git a/src/decoder/DecoderThread.cxx b/src/decoder/DecoderThread.cxx index cc008f324..61c02f558 100644 --- a/src/decoder/DecoderThread.cxx +++ b/src/decoder/DecoderThread.cxx @@ -385,7 +385,7 @@ decoder_run_song(DecoderControl &dc, AtScopeExit(&decoder) { /* flush the last chunk */ - if (decoder.chunk != nullptr) + if (decoder.current_chunk != nullptr) decoder.FlushChunk(); }; |