Skip to content

Commit

Permalink
wav: Make sure the data size is a multiple of blockalign, not an exac…
Browse files Browse the repository at this point in the history
…t match.

I _think_ this is a right thing to do; it fixes a .wav file I have here that
has blockalign==2 when channels==2 and bitspersample==16, which otherwise
would fail.
  • Loading branch information
icculus committed Oct 6, 2020
1 parent 4627426 commit 003a169
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/audio/SDL_wave.c
Expand Up @@ -1334,7 +1334,8 @@ PCM_Init(WaveFile *file, size_t datalength)
/* It wouldn't be that hard to support more exotic block sizes, but
* the most common formats should do for now.
*/
if (format->blockalign * 8 != format->channels * format->bitspersample) {
/* Make sure we're a multiple of the blockalign, at least. */
if ((format->channels * format->bitspersample) % (format->blockalign * 8)) {
return SDL_SetError("Unsupported block alignment");
}

Expand Down

0 comments on commit 003a169

Please sign in to comment.