Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/unpack_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ uint32_t WavpackUnpackSamples (WavpackContext *wpc, int32_t *buffer, uint32_t sa
WavpackStream *wps = wpc->streams [0];
int stream_index = 0;

// if the current block has no audio, or it's not the first block of a multichannel
// if we have no raw block buffered (e.g. a failed seek freed the streams), or the
// current block has no audio, or it's not the first block of a multichannel
// sequence, or the sample we're on is past the last sample in this block...we need
// to free up the streams and read the next block

if (!wps->wphdr.block_samples || !(wps->wphdr.flags & INITIAL_BLOCK) ||
if (!wps->blockbuff || !wps->wphdr.block_samples || !(wps->wphdr.flags & INITIAL_BLOCK) ||
wps->sample_index >= GET_BLOCK_INDEX (wps->wphdr) + wps->wphdr.block_samples) {
int64_t nexthdrpos;

Expand Down
Loading