From 3257374310776091cb1a81f3245d29f161685f94 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 11 Sep 2009 13:32:39 -0700 Subject: 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. --- gst/wavparse/gstwavparse.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gst/wavparse') diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index 77c980cb..4b8a33f9 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -1351,8 +1351,13 @@ gst_wavparse_stream_headers (GstWavParse * wav) } wav->offset += 8; wav->datastart = wav->offset; - /* file might be truncated */ - if (upstream_size) { + /* If size is zero, then the data chunk probably actually extends to + 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)); } wav->datasize = (guint64) size; -- cgit