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.
This commit is contained in:
Sebastian Dröge 2014-12-18 13:22:17 +01:00
parent e527cea8d3
commit 5ecbc9eea2

View file

@ -1208,17 +1208,21 @@ gst_riff_create_audio_caps (guint16 codec_id,
gint wd, ws; gint wd, ws;
GstAudioFormat format; GstAudioFormat format;
/* If we have an empty blockalign, we take the width contained in if (ba > (32 / 8) * ch) {
* strf->bits_per_sample */ GST_WARNING ("Invalid block align: %d > %d", ba, (32 / 8) * ch);
if (ba != 0) 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; wd = ba * 8 / ch;
else } else {
wd = strf->bits_per_sample; wd = GST_ROUND_UP_8 (strf->bits_per_sample);
}
if (strf->bits_per_sample > 32) { if (strf->bits_per_sample > 32) {
GST_WARNING ("invalid depth (%d) of pcm audio, overwriting.", GST_WARNING ("invalid depth (%d) of pcm audio, overwriting.",
strf->bits_per_sample); 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 /* in riff, the depth is stored in the size field but it just means that