diff options
author | Michael Smith <msmith@songbirdnest.com> | 2009-09-11 13:32:39 -0700 |
---|---|---|
committer | Michael Smith <msmith@songbirdnest.com> | 2009-09-11 13:34:01 -0700 |
commit | 3257374310776091cb1a81f3245d29f161685f94 (patch) | |
tree | 7ff331ffc0946eae08ae31c658be08ea71fc9d2a | |
parent | 00ffa9c2dde5361017f7d523970921cfb1937199 (diff) |
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.
-rw-r--r-- | gst/wavparse/gstwavparse.c | 9 |
1 files changed, 7 insertions, 2 deletions
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; |