summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-12-18 13:22:17 +0100
committerSebastian Dröge <sebastian@centricular.com>2014-12-18 13:25:01 +0100
commit5ecbc9eea25f3a5e36b00662ed7412070e3298d7 (patch)
tree4932a56aab1a728e740d0e011cab7158b0315d35
parente527cea8d3c79356579621b6505177fa3c53c3eb (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 8217d79de..2ab5c9d50 100644
--- a/gst-libs/gst/riff/riff-media.c
+++ b/gst-libs/gst/riff/riff-media.c
@@ -1208,17 +1208,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