[vlc-commits] kai: enlarge an audio buffer size to AOUT_MAX_ADVANCE_TIME

KO Myung-Hun git at videolan.org
Sun Mar 3 14:46:11 CET 2013


vlc | branch: master | KO Myung-Hun <komh at chollian.net> | Sun Mar  3 02:09:35 2013 +0900| [8d5cdf7f063d25c013307ef5519408f9e18cda6f] | committer: Rémi Denis-Courmont

kai: enlarge an audio buffer size to AOUT_MAX_ADVANCE_TIME

And add a comment for a condition falling into a indefinite lock.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/audio_output/kai.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/kai.c b/modules/audio_output/kai.c
index 20b995b..18985dc 100644
--- a/modules/audio_output/kai.c
+++ b/modules/audio_output/kai.c
@@ -37,7 +37,7 @@
 
 #define FRAME_SIZE 2048
 
-#define AUDIO_BUFFER_SIZE ( 64 * 1024 )
+#define AUDIO_BUFFER_SIZE_IN_SECONDS ( AOUT_MAX_ADVANCE_TIME / CLOCK_FREQ )
 
 struct audio_buffer_t
 {
@@ -225,7 +225,8 @@ static int Start ( audio_output_t *p_aout, audio_sample_format_t *fmt )
 
     aout_SoftVolumeStart( p_aout );
 
-    CreateBuffer( p_aout, AUDIO_BUFFER_SIZE );
+    CreateBuffer( p_aout, AUDIO_BUFFER_SIZE_IN_SECONDS *
+                          format.i_rate * format.i_bytes_per_frame );
 
     if ( var_Type( p_aout, "audio-device" ) == 0 )
     {
@@ -458,6 +459,9 @@ static int WriteBuffer( audio_output_t *aout, uint8_t *data, int size )
 
     vlc_mutex_lock( &buffer->mutex );
 
+    /* FIXME :
+     * If size is larger than buffer->size, this is locked indefinitely.
+     */
     while( buffer->length + size > buffer->size )
         vlc_cond_wait( &buffer->cond, &buffer->mutex );
 



More information about the vlc-commits mailing list