[vlc-commits] codec/lpcm: fix frame length calculation

Filip Roséen git at videolan.org
Wed Dec 7 10:11:17 CET 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Dec  7 09:48:35 2016 +0100| [8509018c6471495761fc1eb464424985cc1c9e9d] | committer: Jean-Baptiste Kempf

codec/lpcm: fix frame length calculation

i_frame_length denotes the number of bytes for a given audio-output
buffer, with that in mind it is quite easy to see that dividing 8 by
the number of bits in a sample (and not the other way around) yields
an incorrect result.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8509018c6471495761fc1eb464424985cc1c9e9d
---

 modules/codec/lpcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/codec/lpcm.c b/modules/codec/lpcm.c
index 801f12e..f3c22fd 100644
--- a/modules/codec/lpcm.c
+++ b/modules/codec/lpcm.c
@@ -425,7 +425,7 @@ static block_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
     else
     {
         i_frame_length = (p_block->i_buffer - p_sys->i_header_size - i_padding) /
-                         (i_channels + i_channels_padding) * 8 / i_bits;
+                         ( (i_channels + i_channels_padding) * i_bits / 8 );
     }
 
     if( p_sys->b_packetizer )



More information about the vlc-commits mailing list