[vlc-devel] [PATCH 3/3] coreaudio: don't print underrun warning before first play
Thomas Guillem
thomas at gllm.fr
Mon Jul 15 17:21:37 CEST 2019
It's perfectly OK to send 0s before the first buffer is played.
---
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 df468aa736..d7f79bdb54 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -251,6 +251,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
@@ -332,7 +334,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;
@@ -373,6 +377,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;
}
@@ -397,6 +402,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 86eb4caec7..a4ede6c787 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;
--
2.20.1
More information about the vlc-devel
mailing list