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) {
|
if (decoder.initial_seek_running) {
|
||||||
assert(!decoder.seeking);
|
assert(!decoder.seeking);
|
||||||
assert(decoder.chunk == nullptr);
|
assert(decoder.current_chunk == nullptr);
|
||||||
assert(dc.pipe->IsEmpty());
|
assert(dc.pipe->IsEmpty());
|
||||||
|
|
||||||
decoder.initial_seek_running = false;
|
decoder.initial_seek_running = false;
|
||||||
@ -196,9 +196,9 @@ decoder_command_finished(Decoder &decoder)
|
|||||||
|
|
||||||
/* delete frames from the old song position */
|
/* delete frames from the old song position */
|
||||||
|
|
||||||
if (decoder.chunk != nullptr) {
|
if (decoder.current_chunk != nullptr) {
|
||||||
dc.buffer->Return(decoder.chunk);
|
dc.buffer->Return(decoder.current_chunk);
|
||||||
decoder.chunk = nullptr;
|
decoder.current_chunk = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc.pipe->Clear(*dc.buffer);
|
dc.pipe->Clear(*dc.buffer);
|
||||||
@ -400,13 +400,13 @@ do_send_tag(Decoder &decoder, const Tag &tag)
|
|||||||
{
|
{
|
||||||
MusicChunk *chunk;
|
MusicChunk *chunk;
|
||||||
|
|
||||||
if (decoder.chunk != nullptr) {
|
if (decoder.current_chunk != nullptr) {
|
||||||
/* there is a partial chunk - flush it, we want the
|
/* there is a partial chunk - flush it, we want the
|
||||||
tag in a new chunk */
|
tag in a new chunk */
|
||||||
decoder.FlushChunk();
|
decoder.FlushChunk();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(decoder.chunk == nullptr);
|
assert(decoder.current_chunk == nullptr);
|
||||||
|
|
||||||
chunk = decoder.GetChunk();
|
chunk = decoder.GetChunk();
|
||||||
if (chunk == nullptr) {
|
if (chunk == nullptr) {
|
||||||
@ -620,7 +620,7 @@ decoder_replay_gain(Decoder &decoder,
|
|||||||
decoder.replay_gain_info = *replay_gain_info;
|
decoder.replay_gain_info = *replay_gain_info;
|
||||||
decoder.replay_gain_serial = serial;
|
decoder.replay_gain_serial = serial;
|
||||||
|
|
||||||
if (decoder.chunk != nullptr) {
|
if (decoder.current_chunk != nullptr) {
|
||||||
/* flush the current chunk because the new
|
/* flush the current chunk because the new
|
||||||
replay gain values affect the following
|
replay gain values affect the following
|
||||||
samples */
|
samples */
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
Decoder::~Decoder()
|
Decoder::~Decoder()
|
||||||
{
|
{
|
||||||
/* caller must flush the chunk */
|
/* caller must flush the chunk */
|
||||||
assert(chunk == nullptr);
|
assert(current_chunk == nullptr);
|
||||||
|
|
||||||
if (convert != nullptr) {
|
if (convert != nullptr) {
|
||||||
convert->Close();
|
convert->Close();
|
||||||
@ -68,17 +68,17 @@ Decoder::GetChunk()
|
|||||||
{
|
{
|
||||||
DecoderCommand cmd;
|
DecoderCommand cmd;
|
||||||
|
|
||||||
if (chunk != nullptr)
|
if (current_chunk != nullptr)
|
||||||
return chunk;
|
return current_chunk;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
chunk = dc.buffer->Allocate();
|
current_chunk = dc.buffer->Allocate();
|
||||||
if (chunk != nullptr) {
|
if (current_chunk != nullptr) {
|
||||||
chunk->replay_gain_serial = replay_gain_serial;
|
current_chunk->replay_gain_serial = replay_gain_serial;
|
||||||
if (replay_gain_serial != 0)
|
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);
|
cmd = LockNeedChunks(dc);
|
||||||
@ -93,15 +93,14 @@ Decoder::FlushChunk()
|
|||||||
assert(!seeking);
|
assert(!seeking);
|
||||||
assert(!initial_seek_running);
|
assert(!initial_seek_running);
|
||||||
assert(!initial_seek_pending);
|
assert(!initial_seek_pending);
|
||||||
assert(chunk != nullptr);
|
assert(current_chunk != nullptr);
|
||||||
|
|
||||||
|
auto *chunk = std::exchange(current_chunk, nullptr);
|
||||||
if (chunk->IsEmpty())
|
if (chunk->IsEmpty())
|
||||||
dc.buffer->Return(chunk);
|
dc.buffer->Return(chunk);
|
||||||
else
|
else
|
||||||
dc.pipe->Push(chunk);
|
dc.pipe->Push(chunk);
|
||||||
|
|
||||||
chunk = nullptr;
|
|
||||||
|
|
||||||
const ScopeLock protect(dc.mutex);
|
const ScopeLock protect(dc.mutex);
|
||||||
if (dc.client_is_waiting)
|
if (dc.client_is_waiting)
|
||||||
dc.client_cond.signal();
|
dc.client_cond.signal();
|
||||||
|
@ -78,7 +78,7 @@ struct Decoder {
|
|||||||
Tag *decoder_tag = nullptr;
|
Tag *decoder_tag = nullptr;
|
||||||
|
|
||||||
/** the chunk currently being written to */
|
/** the chunk currently being written to */
|
||||||
MusicChunk *chunk = nullptr;
|
MusicChunk *current_chunk = nullptr;
|
||||||
|
|
||||||
ReplayGainInfo replay_gain_info;
|
ReplayGainInfo replay_gain_info;
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ decoder_run_song(DecoderControl &dc,
|
|||||||
|
|
||||||
AtScopeExit(&decoder) {
|
AtScopeExit(&decoder) {
|
||||||
/* flush the last chunk */
|
/* flush the last chunk */
|
||||||
if (decoder.chunk != nullptr)
|
if (decoder.current_chunk != nullptr)
|
||||||
decoder.FlushChunk();
|
decoder.FlushChunk();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user