- Correctly scale bitrate by bits_per_coded_sample instead of assuming 8 bits per byte.
- Prevents wrong bitrate reports for 16-bit PCM WAV files.

Signed-off-by: Erdinc Kaya <[email protected]>
---
 libavformat/riffdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 30835d5f36..d63edc6377 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -130,6 +130,10 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
             par->bits_per_coded_sample = avio_rb16(pb);
         }
     }
+
+    if (par->bits_per_coded_sample)
+        bitrate *= 8.0 / par->bits_per_coded_sample;
+
     if (id == 0xFFFE) {
         par->codec_tag = 0;
     } else {
--
2.43.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to