summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-12-18 13:22:17 +0100
committerTim-Philipp Müller <tim@centricular.com>2015-06-10 19:27:23 +0100
commit5d1690f8b71bb290b27f7dccb8033ade22834dcb (patch)
tree8ec36b406eb5ac22098d3e982155cdd8335d6a6e
parent39b7b6ad2b3df991b97bb8db66072714c10da7bd (diff)
riff: Also handle invalid block aligns for raw audio
Fixes audio playback of http://demo.archermind.com/Test%20Sample/Video/MPEG%204/Divx3/Low-Motion/576-320.avi Audio and video together is still broken because of other issues.
-rw-r--r--gst-libs/gst/riff/riff-media.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gst-libs/gst/riff/riff-media.c b/gst-libs/gst/riff/riff-media.c
index e4d877ee4..02a68b16a 100644
--- a/gst-libs/gst/riff/riff-media.c
+++ b/gst-libs/gst/riff/riff-media.c
@@ -1202,17 +1202,21 @@ gst_riff_create_audio_caps (guint16 codec_id,
gint wd, ws;
GstAudioFormat format;
- /* If we have an empty blockalign, we take the width contained in
- * strf->bits_per_sample */
- if (ba != 0)
+ if (ba > (32 / 8) * ch) {
+ GST_WARNING ("Invalid block align: %d > %d", ba, (32 / 8) * ch);
+ wd = GST_ROUND_UP_8 (strf->bits_per_sample);
+ } else if (ba != 0) {
+ /* If we have an empty blockalign, we take the width contained in
+ * strf->bits_per_sample */
wd = ba * 8 / ch;
- else
- wd = strf->bits_per_sample;
+ } else {
+ wd = GST_ROUND_UP_8 (strf->bits_per_sample);
+ }
if (strf->bits_per_sample > 32) {
GST_WARNING ("invalid depth (%d) of pcm audio, overwriting.",
strf->bits_per_sample);
- strf->bits_per_sample = 8 * ((wd + 7) / 8);
+ strf->bits_per_sample = wd;
}
/* in riff, the depth is stored in the size field but it just means that