[vlc-devel] commit: Fixed buffer size computation with non zero bits per sample mod 8. (Laurent Aimar )

git version control git at videolan.org
Sun Jun 29 00:01:58 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Jun 28 22:03:31 2008 +0000| [64a31ec90363f92c9500bf8fc5882aad85183b22]

Fixed buffer size computation with non zero bits per sample mod 8.

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

 modules/codec/araw.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/modules/codec/araw.c b/modules/codec/araw.c
index 43de4dd..e75e2d4 100644
--- a/modules/codec/araw.c
+++ b/modules/codec/araw.c
@@ -72,6 +72,7 @@ static block_t *EncoderEncode( encoder_t *, aout_buffer_t * );
 struct decoder_sys_t
 {
     const int16_t *p_logtos16;  /* used with m/alaw to int16_t */
+    int i_bytespersample;
 
     audio_date_t end_date;
 };
@@ -404,6 +405,7 @@ static int DecoderOpen( vlc_object_t *p_this )
 
     aout_DateInit( &p_sys->end_date, p_dec->fmt_out.audio.i_rate );
     aout_DateSet( &p_sys->end_date, 0 );
+    p_sys->i_bytespersample = ( p_dec->fmt_in.audio.i_bitspersample + 7 ) / 8;
 
     p_dec->pf_decode_audio = DecodeBlock;
 
@@ -441,7 +443,7 @@ static aout_buffer_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     /* Don't re-use the same pts twice */
     p_block->i_pts = 0;
 
-    i_samples = p_block->i_buffer * 8 / p_dec->fmt_in.audio.i_bitspersample /
+    i_samples = p_block->i_buffer / p_sys->i_bytespersample /
         p_dec->fmt_in.audio.i_channels;
 
     if( i_samples <= 0 )




More information about the vlc-devel mailing list