MusicChunk: remove special case for num_frames==0
Simply return an empty WritableBuffer, not a nulled one.
This commit is contained in:
parent
2ca979425f
commit
cd6e0ff88a
@ -60,9 +60,6 @@ MusicChunk::Write(const AudioFormat af,
|
|||||||
|
|
||||||
const size_t frame_size = af.GetFrameSize();
|
const size_t frame_size = af.GetFrameSize();
|
||||||
size_t num_frames = (sizeof(data) - length) / frame_size;
|
size_t num_frames = (sizeof(data) - length) / frame_size;
|
||||||
if (num_frames == 0)
|
|
||||||
return WritableBuffer<void>::Null();
|
|
||||||
|
|
||||||
return { data + length, num_frames * frame_size };
|
return { data + length, num_frames * frame_size };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,15 +513,13 @@ decoder_data(Decoder &decoder,
|
|||||||
SongTime::FromS(decoder.timestamp) -
|
SongTime::FromS(decoder.timestamp) -
|
||||||
dc.song->GetStartTime(),
|
dc.song->GetStartTime(),
|
||||||
kbit_rate);
|
kbit_rate);
|
||||||
if (dest.IsNull()) {
|
if (dest.IsEmpty()) {
|
||||||
/* the chunk is full, flush it */
|
/* the chunk is full, flush it */
|
||||||
decoder.FlushChunk();
|
decoder.FlushChunk();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nbytes = dest.size;
|
size_t nbytes = dest.size;
|
||||||
assert(nbytes > 0);
|
|
||||||
|
|
||||||
if (nbytes > length)
|
if (nbytes > length)
|
||||||
nbytes = length;
|
nbytes = length;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user