decoder/Internal: rename "chunk" to "current_chunk"
This commit is contained in:
parent
b905933999
commit
595d1942cb
@ -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 */
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user