[vlc-commits] auhal: warn about underrun
Thomas Guillem
git at videolan.org
Wed Feb 22 20:04:39 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 22 19:58:14 2017 +0100| [b439a28f7e31895cae6cbd49724cfadc41bdee6e] | committer: Thomas Guillem
auhal: warn about underrun
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b439a28f7e31895cae6cbd49724cfadc41bdee6e
---
modules/audio_output/auhal.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 53d2a6b..84132f9 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -111,6 +111,7 @@ struct aout_sys_t
/* circular buffer to swap the audio data */
TPCircularBuffer circular_buffer;
+ atomic_uint i_underrun_size;
/* AUHAL specific */
AudioComponent au_component;
@@ -977,7 +978,10 @@ CopyOutput(audio_output_t *p_aout, uint8_t *p_output, size_t i_requested)
/* Pad with 0 */
if (i_requested > i_tocopy)
+ {
+ atomic_fetch_add(&p_sys->i_underrun_size, i_requested - i_tocopy);
memset(&p_output[i_tocopy], 0, i_requested - i_tocopy);
+ }
}
else
memset(p_output, 0, i_requested);
@@ -1104,6 +1108,10 @@ Play(audio_output_t * p_aout, block_t * p_block)
msg_Warn(p_aout, "dropped buffer");
}
+ unsigned i_underrun_size = atomic_exchange(&p_sys->i_underrun_size, 0);
+ if (i_underrun_size > 0)
+ msg_Warn(p_aout, "underrun of %u bytes", i_underrun_size);
+
block_Release(p_block);
}
@@ -2179,6 +2187,7 @@ static int Open(vlc_object_t *obj)
p_sys->b_selected_dev_is_default = false;
memset(&p_sys->sfmt_revert, 0, sizeof(p_sys->sfmt_revert));
p_sys->i_stream_id = 0;
+ atomic_init(&p_sys->i_underrun_size, 0);
atomic_init(&p_sys->b_paused, false);
p_aout->sys = p_sys;
More information about the vlc-commits
mailing list