Module: libav
Branch: release/11
Commit: 7fe26d82fb7cc1de57bceb643eece9eccf7f7bc1

Author:    Hendrik Leppkes <[email protected]>
Committer: Diego Biurrun <[email protected]>
Date:      Wed May  2 16:34:45 2012 +0200

riff: don't overwrite bps from WAVEFORMATEX if EXTENSIBLE doesn't contain that 
data.

According to the specification on the MSDN [1], 0 is valid for that
particular field, and it should be ignored in that case.

[1]: 
http://msdn.microsoft.com/en-us/library/windows/desktop/dd757714(v=vs.85).aspx

Bug-Id: 950

Signed-off-by: Anton Khirnov <[email protected]>
(cherry picked from commit 7f549b8338ed3775fec4bf10421ff5744e5866dd)
Signed-off-by: Diego Biurrun <[email protected]>

---

 libavformat/riffdec.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 74f93ac..6f5350b 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -57,7 +57,11 @@ enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid 
*guids, ff_asf_guid guid)
 static void parse_waveformatex(AVIOContext *pb, AVCodecContext *c)
 {
     ff_asf_guid subformat;
-    c->bits_per_coded_sample = avio_rl16(pb);
+    int bps;
+
+    bps = avio_rl16(pb);
+    if (bps)
+        c->bits_per_coded_sample = bps;
     c->channel_layout        = avio_rl32(pb); /* dwChannelMask */
 
     ff_get_guid(pb, &subformat);

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to