wavparse: treat a zero-sized data chunk as extending to the end of the file.
authorMichael Smith <msmith@songbirdnest.com>
Fri, 11 Sep 2009 20:32:39 +0000 (13:32 -0700)
committerMichael Smith <msmith@songbirdnest.com>
Fri, 11 Sep 2009 20:34:01 +0000 (13:34 -0700)
This fixes playback of some files that don't have a valid data chunk length,
apparently some program creates these.

gst/wavparse/gstwavparse.c

index 77c980c..4b8a33f 100644 (file)
@@ -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;