[vlc-commits] opensles: keep track of the number of buffers we use

Rafaël Carré git at videolan.org
Sun Dec 16 11:12:55 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Sun Dec 16 10:27:13 2012 +0100| [8b5738122d2cf27c0fd5fee1943c9af8695ed254] | committer: Rafaël Carré

opensles: keep track of the number of buffers we use

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

 modules/audio_output/opensles_android.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index f2ee057..5f77e65 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -71,6 +71,8 @@ struct aout_sys_t
     vlc_mutex_t                     lock;
     mtime_t                         length;
 
+    int                             buffers;
+
     /* audio buffered through opensles */
     block_t                        *p_chain;
     block_t                       **pp_last;
@@ -212,14 +214,15 @@ static int WriteBuffer(audio_output_t *p_aout)
 
     if (r == SL_RESULT_SUCCESS) {
         /* Remove that block from the list of audio not yet written */
+        p_sys->buffers++;
         p_sys->p_buffer_chain = next;
         if (!p_sys->p_buffer_chain)
             p_sys->pp_buffer_last = &p_sys->p_buffer_chain;
     } else {
         /* Remove that block from the list of audio already written */
-        msg_Err( p_aout, "error %lu%s (%d bytes)", r, (r == SL_RESULT_BUFFER_INSUFFICIENT)
-                ? " buffer insufficient"
-                : "", b->i_buffer);
+        msg_Err( p_aout, "error %lu when writing %d bytes, %d/255 buffers occupied %s",
+                r, b->i_buffer, p_sys->buffers,
+                (r == SL_RESULT_BUFFER_INSUFFICIENT) ? " (buffer insufficient)" : "");
 
         p_sys->pp_last = pp_last_saved;
         *pp_last_saved = p_last_saved;
@@ -258,6 +261,7 @@ static void PlayedCallback (SLAndroidSimpleBufferQueueItf caller, void *pContext
     assert (caller == p_sys->playerBufferQueue);
 
     vlc_mutex_lock( &p_sys->lock );
+    p_sys->buffers--;
 
     p_block = p_sys->p_chain;
     assert( p_block );



More information about the vlc-commits mailing list