[vlc-commits] coreaudio: don't print underrun warning before first play

Thomas Guillem git at videolan.org
Tue Jul 16 11:55:19 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jul 15 17:01:21 2019 +0200| [a34bf45cd6f4b212b79e71b80c056cb392eaf7f5] | committer: Thomas Guillem

coreaudio: don't print underrun warning before first play

It's perfectly OK to send 0s before the first buffer is played.

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

 modules/audio_output/coreaudio_common.c | 8 +++++++-
 modules/audio_output/coreaudio_common.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index d575b56127..5cb9883ad9 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -250,6 +250,8 @@ ca_Flush(audio_output_t *p_aout)
     p_sys->i_render_host_time = 0;
     p_sys->i_render_frames = 0;
     lock_unlock(p_sys);
+
+    p_sys->b_played = false;
 }
 
 void
@@ -331,7 +333,9 @@ ca_Play(audio_output_t * p_aout, block_t * p_block, vlc_tick_t date)
 
     lock_unlock(p_sys);
 
-    if (i_underrun_size > 0)
+    if (!p_sys->b_played)
+        p_sys->b_played = true;
+    else if (i_underrun_size > 0)
         msg_Warn(p_aout, "underrun of %zu bytes", i_underrun_size);
 
     (void) date;
@@ -374,6 +378,7 @@ ca_Initialize(audio_output_t *p_aout, const audio_sample_format_t *fmt,
     }
 
     ca_ClearOutBuffers(p_aout);
+    p_sys->b_played = false;
 
     return VLC_SUCCESS;
 }
@@ -398,6 +403,7 @@ ca_SetAliveState(audio_output_t *p_aout, bool alive)
     if (!alive && p_sys->b_do_flush)
     {
         ca_ClearOutBuffers(p_aout);
+        p_sys->b_played = false;
         p_sys->b_do_flush = false;
         b_sem_post = true;
     }
diff --git a/modules/audio_output/coreaudio_common.h b/modules/audio_output/coreaudio_common.h
index a860a9aa51..1630c7f0c6 100644
--- a/modules/audio_output/coreaudio_common.h
+++ b/modules/audio_output/coreaudio_common.h
@@ -55,6 +55,7 @@ struct aout_sys_common
 
     size_t              i_out_max_size;
     size_t              i_out_size;
+    bool                b_played;
     block_t             *p_out_chain;
     block_t             **pp_out_last;
     uint64_t            i_render_host_time;



More information about the vlc-commits mailing list