wavparse: treat a zero-sized data chunk as extending to the end of the file.

This fixes playback of some files that don't have a valid data chunk length,
apparently some program creates these.
This commit is contained in:
Michael Smith 2009-09-11 13:32:39 -07:00
parent 00ffa9c2dd
commit 3257374310

View file

@ -1351,8 +1351,13 @@ gst_wavparse_stream_headers (GstWavParse * wav)
} }
wav->offset += 8; wav->offset += 8;
wav->datastart = wav->offset; wav->datastart = wav->offset;
/* file might be truncated */ /* If size is zero, then the data chunk probably actually extends to
if (upstream_size) { the end of the file */
if (size == 0 && upstream_size) {
size = upstream_size - wav->datastart;
}
/* Or the file might be truncated */
else if (upstream_size) {
size = MIN (size, (upstream_size - wav->datastart)); size = MIN (size, (upstream_size - wav->datastart));
} }
wav->datasize = (guint64) size; wav->datasize = (guint64) size;